Преглед изворни кода

Merge branch 'master' of http://unque781.synology.me:3000/GSI/OHV

ys-hwang пре 6 година
родитељ
комит
78ce7826b4
25 измењених фајлова са 521 додато и 189 уклоњено
  1. 3 6
      Dev/Connection/OHVProtocolServer/OHVProtocolClient/MainWindow.xaml.cs
  2. BIN
      Dev/OHV/Assambly/System.Net.Json.dll
  3. 6 0
      Dev/OHV/OHV.Common/Events/MessageEventArgs.cs
  4. 1 0
      Dev/OHV/OHV.Common/Model/Route.cs
  5. 26 0
      Dev/OHV/OHV.Common/Model/RoutePoint.cs
  6. 16 0
      Dev/OHV/OHV.Common/Model/RouteSegment.cs
  7. 2 0
      Dev/OHV/OHV.Common/OHV.Common.csproj
  8. 106 64
      Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoViewModel.cs
  9. 12 4
      Dev/OHV/OHV.Module.ListViews/Views/CommandListViewModel.cs
  10. 5 0
      Dev/OHV/OHV.SqliteDAL/OHVDbInitializer.cs
  11. 9 6
      Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs
  12. BIN
      Dev/OHV/OHV.Vehicle/Config/IO.xlsx
  13. 3 3
      Dev/OHV/OHV.Vehicle/Config/log4net.xml
  14. 1 1
      Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj
  15. 0 1
      Dev/OHV/VehicleControlSystem/ControlLayer/Axis/EzAxis.cs
  16. 5 4
      Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs
  17. 5 0
      Dev/OHV/VehicleControlSystem/ControlLayer/IO/BitBlock.cs
  18. 11 10
      Dev/OHV/VehicleControlSystem/ControlLayer/IO/EzIO.cs
  19. 6 0
      Dev/OHV/VehicleControlSystem/ControlLayer/Serial/BatteryTabos/BMUManager.cs
  20. 99 52
      Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs
  21. 36 1
      Dev/OHV/VehicleControlSystem/Managers/AutoManager.cs
  22. 73 26
      Dev/OHV/VehicleControlSystem/Managers/HostManager.cs
  23. 63 0
      Dev/OHV/VehicleControlSystem/Managers/RouteManager.cs
  24. 13 8
      Dev/OHV/VehicleControlSystem/Managers/Scheduler.cs
  25. 20 3
      Dev/OHV/VehicleControlSystem/VCSystem.cs

+ 3 - 6
Dev/Connection/OHVProtocolServer/OHVProtocolClient/MainWindow.xaml.cs

@@ -100,6 +100,9 @@ namespace OHVProtocolClient
                 case eKind.F:
                 case eKind.F:
                 case eKind.I:
                 case eKind.I:
                 case eKind.O:
                 case eKind.O:
+                case eKind.P:
+                case eKind.L:
+                case eKind.U:
                     ReplyMessage( msg );
                     ReplyMessage( msg );
                     break;
                     break;
 
 
@@ -107,14 +110,8 @@ namespace OHVProtocolClient
                     break;
                     break;
                 case eKind.C:
                 case eKind.C:
                     break;
                     break;
-                case eKind.P:
-                    break;
                 case eKind.A:
                 case eKind.A:
                     break;
                     break;
-                case eKind.L:
-                    break;
-                case eKind.U:
-                    break;
                 case eKind.M:
                 case eKind.M:
                     break;
                     break;
                 case eKind.R:
                 case eKind.R:

BIN
Dev/OHV/Assambly/System.Net.Json.dll


+ 6 - 0
Dev/OHV/OHV.Common/Events/MessageEventArgs.cs

@@ -27,6 +27,8 @@ namespace OHV.Common.Events
             RspEStop,
             RspEStop,
             RspVihicleState,
             RspVihicleState,
             RspMachineModeChg,
             RspMachineModeChg,
+
+            RspAddCommand,
         }
         }
 
 
         //Property 이름임.
         //Property 이름임.
@@ -65,6 +67,9 @@ namespace OHV.Common.Events
             ReqEStop,
             ReqEStop,
             ReqBuzzerStop,
             ReqBuzzerStop,
             ReqMachineModeChg,
             ReqMachineModeChg,
+
+            ReqAddCommand,
+            ReqTest,
         }
         }
 
 
         public eVCSMessageKind Kind { get; set; }
         public eVCSMessageKind Kind { get; set; }
@@ -120,6 +125,7 @@ namespace OHV.Common.Events
         public eEventDir Dir { get; set; }
         public eEventDir Dir { get; set; }
         public eAxisControlKind Kind { get; set; }
         public eAxisControlKind Kind { get; set; }
         public eJogMoveDir JogDir { get; set; }
         public eJogMoveDir JogDir { get; set; }
+        public int JogVelocity { get; set; }
         public string AxisName { get; set; }
         public string AxisName { get; set; }
         public double CurrentPosition { get; set; }
         public double CurrentPosition { get; set; }
 
 

+ 1 - 0
Dev/OHV/OHV.Common/Model/Route.cs

@@ -20,6 +20,7 @@ namespace OHV.Common.Model
         UnloadPort,
         UnloadPort,
         Charging,
         Charging,
         Road, // 일반 길
         Road, // 일반 길
+        Cross,
     }
     }
 
 
 
 

+ 26 - 0
Dev/OHV/OHV.Common/Model/RoutePoint.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OHV.Common.Model
+{
+    public class RoutePoint
+    {
+        public string Name { get; set; }
+        public ePointType Type { get; set; }
+        public List<RouteSegment> Segments { get; set; }
+        public List<string> SegmentsID { get; set; }
+        public List<string> PreRoutes { get; set; }
+        public List<string> NextRoutes { get; set; }
+
+        public RoutePoint()
+        {
+            this.SegmentsID = new List<string>();
+            this.Segments = new List<RouteSegment>();
+            this.PreRoutes = new List<string>();
+            this.NextRoutes = new List<string>();
+        }
+    }
+}

+ 16 - 0
Dev/OHV/OHV.Common/Model/RouteSegment.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OHV.Common.Model
+{
+    public class RouteSegment
+    {
+        public string Name { get; set; }
+        public double Length { get; set; }
+        public eRoadForm From {get;set;}
+        public int MaxSpeed { get; set; }
+    }
+}

+ 2 - 0
Dev/OHV/OHV.Common/OHV.Common.csproj

@@ -86,6 +86,8 @@
     <Compile Include="Model\Config.cs" />
     <Compile Include="Model\Config.cs" />
     <Compile Include="Model\HisAlarm.cs" />
     <Compile Include="Model\HisAlarm.cs" />
     <Compile Include="Model\Route.cs" />
     <Compile Include="Model\Route.cs" />
+    <Compile Include="Model\RoutePoint.cs" />
+    <Compile Include="Model\RouteSegment.cs" />
     <Compile Include="Model\SelectionItem.cs" />
     <Compile Include="Model\SelectionItem.cs" />
     <Compile Include="Model\SelectionList.cs" />
     <Compile Include="Model\SelectionList.cs" />
     <Compile Include="Model\SubCmd.cs" />
     <Compile Include="Model\SubCmd.cs" />

+ 106 - 64
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoViewModel.cs

@@ -49,7 +49,7 @@ namespace OHV.Module.Interactivity.PopUp
             }
             }
         }
         }
 
 
-        double _jogVelocity;
+        double _jogVelocity = 5;
         public double JogVelocity
         public double JogVelocity
         {
         {
             get { return this._jogVelocity; }
             get { return this._jogVelocity; }
@@ -278,41 +278,65 @@ namespace OHV.Module.Interactivity.PopUp
             {
             {
                 if ( r.Result == ButtonResult.OK )
                 if ( r.Result == ButtonResult.OK )
                 {
                 {
-                    if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
+                    switch ( this.SelectedPosition )
                     {
                     {
-                        switch ( this.SelectedPosition )
-                        {
-                            case ConstString.TEACH_POSITION_LOCK:
-                                dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
-                                break;
-                            case ConstString.TEACH_POSITION_UNLOCK:
-                                dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
-                                break;
-                        }
-
-                        var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
-                        //sqlAxisLeft.Value = this.CurrentLockLeft;
-                        sqlAxisLeft.Value = this.TargetPosLockLeft;
-                        sql.AxisPositionDataDAL.Update( sqlAxisLeft );
-                    }
-                    else if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_RIGHT )
-                    {
-                        switch ( this.SelectedPosition )
-                        {
-                            case ConstString.TEACH_POSITION_LOCK:
-                                dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
-                                break;
-                            case ConstString.TEACH_POSITION_UNLOCK:
-                                dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
-                                break;
-                        }
-                        var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
-                        //sqlAxisRight.Value = this.CurrentLockRight;
-                        sqlAxisRight.Value = this.TargetPosLockRight;
-                        sql.AxisPositionDataDAL.Update( sqlAxisRight );
+                        case ConstString.TEACH_POSITION_LOCK:
+                            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                            break;
+                        case ConstString.TEACH_POSITION_UNLOCK:
+                            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                            break;
                     }
                     }
-                    else
-                    { }
+
+                    var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
+                    //sqlAxisLeft.Value = this.CurrentLockLeft;
+                    sqlAxisLeft.Value = this.TargetPosLockLeft;
+                    sql.AxisPositionDataDAL.Update( sqlAxisLeft );
+
+                    var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+                    //sqlAxisRight.Value = this.CurrentLockRight;
+                    sqlAxisRight.Value = this.TargetPosLockRight;
+                    sql.AxisPositionDataDAL.Update( sqlAxisRight );
+                    //if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
+                    //{
+                    //    switch ( this.SelectedPosition )
+                    //    {
+                    //        case ConstString.TEACH_POSITION_LOCK:
+                    //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                    //            break;
+                    //        case ConstString.TEACH_POSITION_UNLOCK:
+                    //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                    //            break;
+                    //    }
+
+                    //    var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
+                    //    //sqlAxisLeft.Value = this.CurrentLockLeft;
+                    //    sqlAxisLeft.Value = this.TargetPosLockLeft;
+                    //    sql.AxisPositionDataDAL.Update( sqlAxisLeft );
+
+                    //    var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+                    //    //sqlAxisRight.Value = this.CurrentLockRight;
+                    //    sqlAxisRight.Value = this.TargetPosLockRight;
+                    //    sql.AxisPositionDataDAL.Update( sqlAxisRight );
+                    //}
+                    //else if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_RIGHT )
+                    //{
+                    //    switch ( this.SelectedPosition )
+                    //    {
+                    //        case ConstString.TEACH_POSITION_LOCK:
+                    //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                    //            break;
+                    //        case ConstString.TEACH_POSITION_UNLOCK:
+                    //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                    //            break;
+                    //    }
+                    //    var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+                    //    //sqlAxisRight.Value = this.CurrentLockRight;
+                    //    sqlAxisRight.Value = this.TargetPosLockRight;
+                    //    sql.AxisPositionDataDAL.Update( sqlAxisRight );
+                    //}
+                    //else
+                    //{ }
                 }
                 }
             } );
             } );
         }
         }
@@ -327,9 +351,10 @@ namespace OHV.Module.Interactivity.PopUp
 
 
             var msg = new AxisControlEventArgs
             var msg = new AxisControlEventArgs
             {
             {
-                Dir = AxisControlEventArgs.eEventDir.ToBack ,
-                Kind = AxisControlEventArgs.eAxisControlKind.Jog ,
-                AxisName = this.SelectAxis ,
+                Dir = AxisControlEventArgs.eEventDir.ToBack,
+                Kind = AxisControlEventArgs.eAxisControlKind.Jog,
+                AxisName = this.SelectAxis,
+                JogVelocity = Convert.ToInt32( this.JogVelocity ),
             };
             };
 
 
             if ( obj.ToString().Equals( "+" ) )
             if ( obj.ToString().Equals( "+" ) )
@@ -521,6 +546,7 @@ namespace OHV.Module.Interactivity.PopUp
                   {
                   {
                       var msg = new AxisControlEventArgs();
                       var msg = new AxisControlEventArgs();
                       msg.Kind = AxisControlEventArgs.eAxisControlKind.Move;
                       msg.Kind = AxisControlEventArgs.eAxisControlKind.Move;
+                      msg.AxisName = this.SelectAxis;
 
 
                       if ( SelectedPosition.Equals( ConstString.TEACH_POSITION_LOCK ) )
                       if ( SelectedPosition.Equals( ConstString.TEACH_POSITION_LOCK ) )
                           msg.PosDir = AxisControlEventArgs.ePosDir.Lock;
                           msg.PosDir = AxisControlEventArgs.ePosDir.Lock;
@@ -534,7 +560,7 @@ namespace OHV.Module.Interactivity.PopUp
 
 
         private void ExecuteSelectPosCommand( object obj )
         private void ExecuteSelectPosCommand( object obj )
         {
         {
-            List<Common.Model.AxisPositionData> dataList = null;
+            List<Common.Model.AxisPositionData> positionList = null;
             this.SelectedPosition = obj.ToString();
             this.SelectedPosition = obj.ToString();
 
 
             if ( obj.Equals( ConstString.TEACH_POSITION_LOCK ) )
             if ( obj.Equals( ConstString.TEACH_POSITION_LOCK ) )
@@ -548,34 +574,50 @@ namespace OHV.Module.Interactivity.PopUp
                 this.PosUnlockBrush = Brushes.Orange;
                 this.PosUnlockBrush = Brushes.Orange;
             }
             }
 
 
-            if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
-            {
-                switch ( this.SelectedPosition )
-                {
-                    case ConstString.TEACH_POSITION_LOCK:
-                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
-                        break;
-                    case ConstString.TEACH_POSITION_UNLOCK:
-                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
-                        break;
-                }
-                var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
-                this.TargetPosLockLeft = sqlAxisLeft.Value;
-            }
-            else
+
+            switch ( this.SelectedPosition )
             {
             {
-                switch ( this.SelectedPosition )
-                {
-                    case ConstString.TEACH_POSITION_LOCK:
-                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
-                        break;
-                    case ConstString.TEACH_POSITION_UNLOCK:
-                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
-                        break;
-                }
-                var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
-                this.TargetPosLockRight = sqlAxisRight.Value;
+                case ConstString.TEACH_POSITION_LOCK:
+                    positionList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                    break;
+                case ConstString.TEACH_POSITION_UNLOCK:
+                    positionList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                    break;
             }
             }
+            var sqlAxisLeft = positionList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
+            this.TargetPosLockLeft = sqlAxisLeft.Value;
+
+            var sqlAxisRight = positionList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+            this.TargetPosLockRight = sqlAxisRight.Value;
+
+            //if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
+            //{
+            //    switch ( this.SelectedPosition )
+            //    {
+            //        case ConstString.TEACH_POSITION_LOCK:
+            //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+            //            break;
+            //        case ConstString.TEACH_POSITION_UNLOCK:
+            //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+            //            break;
+            //    }
+            //    var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
+            //    this.TargetPosLockLeft = sqlAxisLeft.Value;
+            //}
+            //else
+            //{
+            //    switch ( this.SelectedPosition )
+            //    {
+            //        case ConstString.TEACH_POSITION_LOCK:
+            //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+            //            break;
+            //        case ConstString.TEACH_POSITION_UNLOCK:
+            //            dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+            //            break;
+            //    }
+            //    var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+            //    this.TargetPosLockRight = sqlAxisRight.Value;
+            //}
         }
         }
 
 
         private void ExecuteSelectAxisCommand( object obj )
         private void ExecuteSelectAxisCommand( object obj )

+ 12 - 4
Dev/OHV/OHV.Module.ListViews/Views/CommandListViewModel.cs

@@ -99,15 +99,23 @@ namespace OHV.Module.ListViews.Views
 
 
         private void ExecuteSaveCommand()
         private void ExecuteSaveCommand()
         {
         {
-            Command cmd = new Command() { TargetID = TargetID, Type = SelectedCommandType };
-            cmd.ByWho = eCommandByWho.LocalSystem;
-
             var route = sql.RouteDal.GetRoute( TargetID );
             var route = sql.RouteDal.GetRoute( TargetID );
             if (route ==null )
             if (route ==null )
                 messageController.ShowNotificationView( "Not Found TargetID" );
                 messageController.ShowNotificationView( "Not Found TargetID" );
             else
             else
-                sql.CommandDAL.Add(cmd);
+            {
+                Command cmd = new Command() { TargetID = TargetID, Type = SelectedCommandType };
+                cmd.ByWho = eCommandByWho.LocalSystem;
+
+                var msg = new VCSMessageEventArgs();
+                msg.Kind = VCSMessageEventArgs.eVCSMessageKind.ReqAddCommand;
+                msg.Command = cmd;
+
+                this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( msg );
+            }
+
 
 
+            //UI 초기화
             this.TargetID = "None";
             this.TargetID = "None";
             this.SelectedCommandType = eCommandType.Move;
             this.SelectedCommandType = eCommandType.Move;
         }
         }

+ 5 - 0
Dev/OHV/OHV.SqliteDAL/OHVDbInitializer.cs

@@ -179,6 +179,11 @@ namespace OHV.SqliteDAL
                 new Alarm { AlarmId = 22, Kind = eAlarmKind.Axis, Name = "Init",           Text="Vehicle Drive Error",                     Solution="", Description="", Level = eAlarmLevel.Falut, },
                 new Alarm { AlarmId = 22, Kind = eAlarmKind.Axis, Name = "Init",           Text="Vehicle Drive Error",                     Solution="", Description="", Level = eAlarmLevel.Falut, },
                 new Alarm { AlarmId = 23, Kind = eAlarmKind.Axis, Name = "EStop",          Text="EStop",                                   Solution="", Description="", Level = eAlarmLevel.Falut, },
                 new Alarm { AlarmId = 23, Kind = eAlarmKind.Axis, Name = "EStop",          Text="EStop",                                   Solution="", Description="", Level = eAlarmLevel.Falut, },
                 new Alarm { AlarmId = 24, Kind = eAlarmKind.Axis, Name = "Vehicle Move Error", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
                 new Alarm { AlarmId = 24, Kind = eAlarmKind.Axis, Name = "Vehicle Move Error", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
+                new Alarm { AlarmId = 25, Kind = eAlarmKind.Axis, Name = "Charge", Text="Charge Point Not Ready",                          Solution="", Description="", Level = eAlarmLevel.Falut, },
+                new Alarm { AlarmId = 26, Kind = eAlarmKind.Axis, Name = "Charge", Text="Charge Point PIO Error",                          Solution="", Description="", Level = eAlarmLevel.Falut, },
+                new Alarm { AlarmId = 27, Kind = eAlarmKind.Axis, Name = "Charge", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
+                new Alarm { AlarmId = 28, Kind = eAlarmKind.Axis, Name = "Charge", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
+                new Alarm { AlarmId = 29, Kind = eAlarmKind.Axis, Name = "Charge", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
             } );
             } );
 
 
             //context.Set<HisAlarm>().Add(new HisAlarm { AlarmId = 1, OccurTime = DateTime.Now.AddDays(-10) });
             //context.Set<HisAlarm>().Add(new HisAlarm { AlarmId = 1, OccurTime = DateTime.Now.AddDays(-10) });

+ 9 - 6
Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs

@@ -227,7 +227,7 @@ namespace OHV.Vehicle.Concept
             //this.VehicleIP = sql.ConfigDal.GetK( ConstString.Addr ).Value;
             //this.VehicleIP = sql.ConfigDal.GetK( ConstString.Addr ).Value;
             this.OcsIP = sql.ConfigDal.GetK( ConstString.Addr ).Value;
             this.OcsIP = sql.ConfigDal.GetK( ConstString.Addr ).Value;
 
 
-            //this.TestCommand = new DelegateCommand( ExecuteTextCommand );
+            this.TestCommand = new DelegateCommand( ExecuteTextCommand );
             this.NavigateCommand = new DelegateCommand<object>(this.Navigate);
             this.NavigateCommand = new DelegateCommand<object>(this.Navigate);
             this.SystemOffCommand = new DelegateCommand(ExecuteSystemOffCommand);
             this.SystemOffCommand = new DelegateCommand(ExecuteSystemOffCommand);
             this.ChangeLanguage = new DelegateCommand(Execte_ChangeLanguage);
             this.ChangeLanguage = new DelegateCommand(Execte_ChangeLanguage);
@@ -288,6 +288,8 @@ namespace OHV.Vehicle.Concept
                 Kind = VCSMessageEventArgs.eVCSMessageKind.ReqBuzzerStop ,
                 Kind = VCSMessageEventArgs.eVCSMessageKind.ReqBuzzerStop ,
             };
             };
             vcsMessagePublisher.Publish( msg );
             vcsMessagePublisher.Publish( msg );
+
+            this.ExecuteTextCommand();
         }
         }
 
 
         private void Execte_ChangeLanguage()
         private void Execte_ChangeLanguage()
@@ -495,12 +497,13 @@ namespace OHV.Vehicle.Concept
 
 
         private void ExecuteTextCommand()
         private void ExecuteTextCommand()
         {
         {
-            //var m = new VCSMessageEventArgs();
-            //m.MessageKey = 1234;
-            //m.MessageText = "Test Message";
-            //m.Command = new Common.Model.Command() { CommandID = "TestCommand123", Type = Common.Shareds.eCommandType.Move };
+            var m = new VCSMessageEventArgs();
+            m.MessageKey = "";
+            m.MessageText = "Test Message";
+            m.Kind = VCSMessageEventArgs.eVCSMessageKind.ReqTest;
+            m.Command = new Common.Model.Command() { CommandID = "TestCommand123", Type = Common.Shareds.eCommandType.Move };
 
 
-            //this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish(m);
+            this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( m );
         }
         }
 
 
         public void InitViewModel()
         public void InitViewModel()

BIN
Dev/OHV/OHV.Vehicle/Config/IO.xlsx


+ 3 - 3
Dev/OHV/OHV.Vehicle/Config/log4net.xml

@@ -41,7 +41,7 @@
     <file value="C:\LOG\OHV\Vehicle\PhysicalCheckup\PhysicalCheckup.log" />
     <file value="C:\LOG\OHV\Vehicle\PhysicalCheckup\PhysicalCheckup.log" />
     <appendToFile value="true" />
     <appendToFile value="true" />
     <rollingStyle value="Date" />
     <rollingStyle value="Date" />
-    <backupDays value="180" />
+    <backupDays value="20" />
     <datePattern value="-MMdd'.log'" />
     <datePattern value="-MMdd'.log'" />
     <layout type="log4net.Layout.PatternLayout">
     <layout type="log4net.Layout.PatternLayout">
       <conversionPattern value="%d{MM-dd HH:mm:ss.fff} %2t %p %m%n" />
       <conversionPattern value="%d{MM-dd HH:mm:ss.fff} %2t %p %m%n" />
@@ -49,10 +49,10 @@
   </appender>
   </appender>
 
 
   <appender name="FileAppender" type="GSG.NET.Logging.FileAppender, GSG.NET">
   <appender name="FileAppender" type="GSG.NET.Logging.FileAppender, GSG.NET">
-		<!--<filter type="log4net.Filter.LevelRangeFilter">
+		<filter type="log4net.Filter.LevelRangeFilter">
 			<param name="LevelMin" value="INFO"></param>
 			<param name="LevelMin" value="INFO"></param>
 			<param name="LevelMax" value="OFF"></param>
 			<param name="LevelMax" value="OFF"></param>
-		</filter>-->
+		</filter>
     <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
     <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
     <file type="log4net.Util.PatternString">
     <file type="log4net.Util.PatternString">
       <conversionPattern value="C:\LOG\OHV\Vehicle\Vehicle.log"  />
       <conversionPattern value="C:\LOG\OHV\Vehicle\Vehicle.log"  />

+ 1 - 1
Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj

@@ -54,7 +54,7 @@
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote|AnyCPU'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote|AnyCPU'">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>\\Ohv_001\VCS\</OutputPath>
+    <OutputPath>\\192.168.127.10\VCS\</OutputPath>
     <DefineConstants>TRACE;DEBUG</DefineConstants>
     <DefineConstants>TRACE;DEBUG</DefineConstants>
     <DebugType>full</DebugType>
     <DebugType>full</DebugType>
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>

+ 0 - 1
Dev/OHV/VehicleControlSystem/ControlLayer/Axis/EzAxis.cs

@@ -255,7 +255,6 @@ namespace VehicleControlSystem.ControlLayer.Axis
             else
             else
                 uiVelocity = (uint)Convert.ToInt32( dVelocity / this.Config.Scale );
                 uiVelocity = (uint)Convert.ToInt32( dVelocity / this.Config.Scale );
 
 
-            uiVelocity = 50;
             if( dir == E_JogMoveDir.Positive )
             if( dir == E_JogMoveDir.Positive )
                 return EziMOTIONPlusELib.FAS_MoveVelocity( Config.AxisNo, uiVelocity, EziSERVO2PlusE.DIR_INC );
                 return EziMOTIONPlusELib.FAS_MoveVelocity( Config.AxisNo, uiVelocity, EziSERVO2PlusE.DIR_INC );
             else
             else

+ 5 - 4
Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs

@@ -294,10 +294,11 @@ namespace VehicleControlSystem.ControlLayer
 
 
         void ReqJog(AxisControlEventArgs arg)
         void ReqJog(AxisControlEventArgs arg)
         {
         {
+            var velocity = arg.JogVelocity;
             if (arg.JogDir == AxisControlEventArgs.eJogMoveDir.Positive)
             if (arg.JogDir == AxisControlEventArgs.eJogMoveDir.Positive)
-                this.JogMove(arg.AxisName, E_JogMoveDir.Positive, 0);
+                this.JogMove(arg.AxisName, E_JogMoveDir.Positive, velocity);
             else
             else
-                this.JogMove(arg.AxisName, E_JogMoveDir.Negative, 0);
+                this.JogMove(arg.AxisName, E_JogMoveDir.Negative, velocity);
         }
         }
 
 
         void ReqOriginReturn(AxisControlEventArgs arg)
         void ReqOriginReturn(AxisControlEventArgs arg)
@@ -330,7 +331,7 @@ namespace VehicleControlSystem.ControlLayer
 
 
             if (arg.PosDir == AxisControlEventArgs.ePosDir.Lock)
             if (arg.PosDir == AxisControlEventArgs.ePosDir.Lock)
             {
             {
-                result = Lock_Sync();
+                result = this.MoveToLockPosition( arg.AxisName );
                 if (result != 0)
                 if (result != 0)
                 {
                 {
                     var alarm = this.sql.AlarmDAL.GetK(result);
                     var alarm = this.sql.AlarmDAL.GetK(result);
@@ -347,7 +348,7 @@ namespace VehicleControlSystem.ControlLayer
             }
             }
             else
             else
             {
             {
-                result = Unlock_Sync();
+                result = this.MoveToUnlockPosition( arg.AxisName );
                 if (result != 0)
                 if (result != 0)
                 {
                 {
                     var alarm = this.sql.AlarmDAL.GetK(result);
                     var alarm = this.sql.AlarmDAL.GetK(result);

+ 5 - 0
Dev/OHV/VehicleControlSystem/ControlLayer/IO/BitBlock.cs

@@ -32,5 +32,10 @@ namespace VehicleControlSystem.ControlLayer.IO
 
 
         public bool IsBitOn { get; set; } = false;
         public bool IsBitOn { get; set; } = false;
         public bool IsChanged { get; set; } = false;
         public bool IsChanged { get; set; } = false;
+
+        public BitBlock Clone()
+        {
+            return ( BitBlock)MemberwiseClone();
+        }
     }
     }
 }
 }

+ 11 - 10
Dev/OHV/VehicleControlSystem/ControlLayer/IO/EzIO.cs

@@ -92,7 +92,6 @@ namespace VehicleControlSystem.ControlLayer.IO
                     this.qQ.Enqueue(new QoDiconnected());
                     this.qQ.Enqueue(new QoDiconnected());
                 else
                 else
                     this.qQ.Enqueue(new QoConnected());
                     this.qQ.Enqueue(new QoConnected());
-
             }
             }
         }
         }
 
 
@@ -453,22 +452,23 @@ namespace VehicleControlSystem.ControlLayer.IO
                             if (EziMOTIONPlusELib.FAS_GetAllStatus(board.BoardID, ref axisDIn, ref axisDOut, ref axisStatus,
                             if (EziMOTIONPlusELib.FAS_GetAllStatus(board.BoardID, ref axisDIn, ref axisDOut, ref axisStatus,
                                 ref cmdPos, ref actPos, ref posErr, ref actVel, ref posItemNo) == EziMOTIONPlusELib.FMM_OK)
                                 ref cmdPos, ref actPos, ref posErr, ref actVel, ref posItemNo) == EziMOTIONPlusELib.FMM_OK)
                             {
                             {
+                                //if ( this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).Count() <= 0 ) break;
 
 
-                                if ( this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).Count() <= 0 ) break;
-
-                                var input = this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).DefaultIfEmpty().ToList();
+                                var input = this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).ToList();
                                 input.ForEach(i =>
                                 input.ForEach(i =>
                                {
                                {
                                    var isOn = Convert.ToBoolean(axisDIn & this.servoAmpInputBitOnMask[i.Index]) ? true : false;
                                    var isOn = Convert.ToBoolean(axisDIn & this.servoAmpInputBitOnMask[i.Index]) ? true : false;
-                                   if (i.IsBitOn != isOn) i.IsChanged = true;
+                                   if (i.IsBitOn != isOn) 
+                                       i.IsChanged = true;
                                    i.IsBitOn = isOn;
                                    i.IsBitOn = isOn;
                                });
                                });
 
 
-                                var output = this._outPutIOList.Where(x => x.BoardNo == board.BoardID).DefaultIfEmpty().ToList();
+                                var output = this._outPutIOList.Where(x => x.BoardNo == board.BoardID).ToList();
                                 output.ForEach(o =>
                                 output.ForEach(o =>
                                {
                                {
                                    var isOn = Convert.ToBoolean(axisDOut & this.servoAmpOutputBitMask[o.Index]) ? true : false;
                                    var isOn = Convert.ToBoolean(axisDOut & this.servoAmpOutputBitMask[o.Index]) ? true : false;
-                                   if (o.IsBitOn != isOn) o.IsChanged = true;
+                                   if (o.IsBitOn != isOn) 
+                                       o.IsChanged = true;
                                    o.IsBitOn = isOn;
                                    o.IsBitOn = isOn;
                                });
                                });
                             }
                             }
@@ -482,11 +482,12 @@ namespace VehicleControlSystem.ControlLayer.IO
                             result = EziMOTIONPlusELib.FAS_GetInput(board.BoardID, ref inValue, ref latchValue);
                             result = EziMOTIONPlusELib.FAS_GetInput(board.BoardID, ref inValue, ref latchValue);
                             if (result == EziMOTIONPlusELib.FMM_OK)
                             if (result == EziMOTIONPlusELib.FMM_OK)
                             {
                             {
-                                var input = this._inPutIOList.Where(x => x.BoardNo == board.BoardID).DefaultIfEmpty().ToList();
+                                var input = this._inPutIOList.Where(x => x.BoardNo == board.BoardID).ToList();
                                 input.ForEach(i =>
                                 input.ForEach(i =>
                                {
                                {
                                    var isOn = Convert.ToBoolean(inValue & this.bitOnMask[i.Index]) ? true : false;
                                    var isOn = Convert.ToBoolean(inValue & this.bitOnMask[i.Index]) ? true : false;
-                                   if (i.IsBitOn != isOn) i.IsChanged = true;
+                                   if (i.IsBitOn != isOn) 
+                                       i.IsChanged = true;
                                    i.IsBitOn = isOn;
                                    i.IsBitOn = isOn;
                                });
                                });
                             }
                             }
@@ -502,7 +503,7 @@ namespace VehicleControlSystem.ControlLayer.IO
                             result = EziMOTIONPlusELib.FAS_GetOutput(board.BoardID, ref outValue, ref outStatus);
                             result = EziMOTIONPlusELib.FAS_GetOutput(board.BoardID, ref outValue, ref outStatus);
                             if (result == EziMOTIONPlusELib.FMM_OK)
                             if (result == EziMOTIONPlusELib.FMM_OK)
                             {
                             {
-                                var output = this._outPutIOList.Where(x => x.BoardNo == board.BoardID).DefaultIfEmpty().ToList();
+                                var output = this._outPutIOList.Where(x => x.BoardNo == board.BoardID).ToList();
                                 output.ForEach(o =>
                                 output.ForEach(o =>
                                {
                                {
                                    var isOn = Convert.ToBoolean(outValue & this.bitOnMask[o.Index]) ? true : false;
                                    var isOn = Convert.ToBoolean(outValue & this.bitOnMask[o.Index]) ? true : false;

+ 6 - 0
Dev/OHV/VehicleControlSystem/ControlLayer/Serial/BatteryTabos/BMUManager.cs

@@ -232,6 +232,12 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
             this.cancel.Cancel();
             this.cancel.Cancel();
             this.cancel.StopWaitAll();
             this.cancel.StopWaitAll();
         }
         }
+
+        public void test()
+        {
+            var clone = this.ReceivedDataDic.Values.FirstOrDefault(); 
+            this.qq.Enqueue( new QoReceivedDataChanged { Arg0 = clone } );
+        }
         #endregion
         #endregion
     }
     }
 }
 }

+ 99 - 52
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -256,6 +256,7 @@ namespace VehicleControlSystem.ControlLayer
 
 
         ThreadCancel cancel = new ThreadCancel();
         ThreadCancel cancel = new ThreadCancel();
         TaskCancel taskCancel = new TaskCancel();
         TaskCancel taskCancel = new TaskCancel();
+        TaskCancel taskMoveCancel = new TaskCancel();
 
 
         IEventAggregator eventAggregator;
         IEventAggregator eventAggregator;
 
 
@@ -407,10 +408,10 @@ namespace VehicleControlSystem.ControlLayer
 
 
         private void ReqConveyor( DriveControlEventArgs args )
         private void ReqConveyor( DriveControlEventArgs args )
         {
         {
-            if ( args.CvDir == DriveControlEventArgs.eCvDir.CW )
-                this.OnOffConveyor( true, true );
-            else if ( args.CvDir == DriveControlEventArgs.eCvDir.CCW )
+            if ( args.CvDir == DriveControlEventArgs.eCvDir.CW ) //Load
                 this.OnOffConveyor( true, false );
                 this.OnOffConveyor( true, false );
+            else if ( args.CvDir == DriveControlEventArgs.eCvDir.CCW ) //Unload
+                this.OnOffConveyor( true, true );
             else if ( args.CvDir == DriveControlEventArgs.eCvDir.STOP )
             else if ( args.CvDir == DriveControlEventArgs.eCvDir.STOP )
                 this.OnOffConveyor( false, false );
                 this.OnOffConveyor( false, false );
         }
         }
@@ -681,11 +682,13 @@ namespace VehicleControlSystem.ControlLayer
             }
             }
             logger.D( "Vehicle - _ThSubCmdWorker Dispose" );
             logger.D( "Vehicle - _ThSubCmdWorker Dispose" );
         }
         }
+
         #endregion
         #endregion
 
 
         #region Control Action Method
         #region Control Action Method
         public void EStop()
         public void EStop()
         {
         {
+            OnOffConveyor( false );
             //Clamp EStop
             //Clamp EStop
             this.clamp.ClampEStop();
             this.clamp.ClampEStop();
             this.motion.EStop();
             this.motion.EStop();
@@ -693,18 +696,14 @@ namespace VehicleControlSystem.ControlLayer
             this.OccurVehicleAlarm( 23 );
             this.OccurVehicleAlarm( 23 );
         }
         }
 
 
+        #region For Moving
         void Move( SubCmd sub )
         void Move( SubCmd sub )
         {
         {
             if ( this.MoveTo( sub.TargetID ) )
             if ( this.MoveTo( sub.TargetID ) )
             {
             {
-                sql.SubCmdDAL.Delete( sub );
-            }
-            else
-            {
-                if ( this.ObstacleStateProperty == eObstacleState.Blocked )
-                {
-                }
             }
             }
+
+            sql.SubCmdDAL.Delete( sub );
         }
         }
 
 
         bool MoveTo( string pointID )
         bool MoveTo( string pointID )
@@ -727,11 +726,21 @@ namespace VehicleControlSystem.ControlLayer
             this.OnMoving?.Invoke();
             this.OnMoving?.Invoke();
             this.IsMoving = true;
             this.IsMoving = true;
 
 
+            //이전에 있던 작업들 종료 및 삭제
+            this.taskMoveCancel.Cancel();
+            this.taskMoveCancel.WaitAll();
+
+            this.taskMoveCancel.Add( CheckCrossPoint() );
+
             //this.BuzzerOnOff(true, eBuzzerKind.Moving);
             //this.BuzzerOnOff(true, eBuzzerKind.Moving);
             this.motion.MoveToPoint( pointID, 100 );
             this.motion.MoveToPoint( pointID, 100 );
 
 
             bool result = Wait4MoveDone();
             bool result = Wait4MoveDone();
             //this.BuzzerOnOff(false);
             //this.BuzzerOnOff(false);
+
+            this.taskMoveCancel.Cancel();
+            this.taskMoveCancel.WaitAll();
+
             if ( motion.IsStop )
             if ( motion.IsStop )
             {
             {
                 this.IsMoving = false;
                 this.IsMoving = false;
@@ -795,6 +804,24 @@ namespace VehicleControlSystem.ControlLayer
             return true;
             return true;
         }
         }
 
 
+        Task CheckCrossPoint()
+        {
+            var task = Task.Run( () => 
+            {
+                long sTime = SwUtils.CurrentTimeMillis;
+
+                while ( !this.taskMoveCancel.Canceled )
+                {
+                    Thread.Sleep( 10 );
+
+                    //ToDo: approach Cross Point Check
+                }
+            } );
+
+            return task;
+        }
+        #endregion
+
         public bool LoadCarrier( SubCmd sub )
         public bool LoadCarrier( SubCmd sub )
         {
         {
             this.VehicleStateProperty = eVehicleState.Load;
             this.VehicleStateProperty = eVehicleState.Load;
@@ -814,12 +841,15 @@ namespace VehicleControlSystem.ControlLayer
                 return false;
                 return false;
             }
             }
 
 
+            this.iO.OutputOn( "OUT_PIO_SENSOR_ONOFF" );
             result = this.PIOAndLoad( sub.TargetID );
             result = this.PIOAndLoad( sub.TargetID );
             if ( result != 0 )
             if ( result != 0 )
             {
             {
+                this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
                 this.OccurVehicleAlarm( result );
                 this.OccurVehicleAlarm( result );
                 return false;
                 return false;
             }
             }
+            this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
 
 
             result = this.clamp.Lock_Sync();
             result = this.clamp.Lock_Sync();
             if ( result != 0 )
             if ( result != 0 )
@@ -856,12 +886,16 @@ namespace VehicleControlSystem.ControlLayer
                 return false;
                 return false;
             }
             }
 
 
+            this.iO.OutputOn( "OUT_PIO_SENSOR_ONOFF" );
+
             result = this.PIOAndUnload( sub.TargetID );
             result = this.PIOAndUnload( sub.TargetID );
             if ( result != 0 )
             if ( result != 0 )
             {
             {
+                this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
                 this.OccurVehicleAlarm( result );
                 this.OccurVehicleAlarm( result );
                 return false;
                 return false;
             }
             }
+            this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
 
 
             sql.CommandDAL.UpdateState( sub.CmdID, eCommandState.Complete );
             sql.CommandDAL.UpdateState( sub.CmdID, eCommandState.Complete );
             sql.SubCmdDAL.Delete( sub );
             sql.SubCmdDAL.Delete( sub );
@@ -871,33 +905,48 @@ namespace VehicleControlSystem.ControlLayer
             return true;
             return true;
         }
         }
 
 
+        private void BatteryCharge( SubCmd subCmd )
+        {
+            this.VehicleStateProperty = eVehicleState.Charge;
+
+            this.iO.OutputOn( "OUT_PIO_SENSOR_ONOFF" );
+            
+            this.PIOBatteryCharge( subCmd );
+            
+            this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
+
+            sql.CommandDAL.UpdateState( subCmd.CmdID, eCommandState.Complete );
+            sql.SubCmdDAL.Delete( subCmd );
+
+            this.VehicleStateProperty = eVehicleState.Idle;
+        }
+
         /// <summary>
         /// <summary>
         /// Battery Charge
         /// Battery Charge
         /// 충전 시 PIO 를 해야 함.
         /// 충전 시 PIO 를 해야 함.
         /// </summary>
         /// </summary>
         /// <param name="sub"></param>
         /// <param name="sub"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public bool BatteryCharge( SubCmd sub )
+        public int PIOBatteryCharge( SubCmd sub )
         {
         {
             var route = sql.RouteDal.GetRoute( sub.TargetID );
             var route = sql.RouteDal.GetRoute( sub.TargetID );
 
 
             if ( !CorrectPosition( route, this.CurrentPosition ) )
             if ( !CorrectPosition( route, this.CurrentPosition ) )
             {
             {
                 this.OccurVehicleAlarm( 21 );
                 this.OccurVehicleAlarm( 21 );
-                return false; //Alarm
+                return 0; //Alarm
             }
             }
 
 
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
 
 
             PIOClear();
             PIOClear();
-            loggerPIO.I( $"Start Unload PIO - [{sub.TargetID}]" );
-            this.OnPIOStart?.Invoke( false );
-
+            loggerPIO.I( $"Start Charge PIO - [{sub.TargetID}]" );
             if ( !this.iO.IsOn( "IN_PIO_READY" ) )
             if ( !this.iO.IsOn( "IN_PIO_READY" ) )
             {
             {
                 loggerPIO.E( "[Port] - 1 Ready not On" );
                 loggerPIO.E( "[Port] - 1 Ready not On" );
-                this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
-                //return 0;
+                this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
+                this.OccurVehicleAlarm( 25 );
+                return 0;
             }
             }
 
 
             this.iO.WriteOutputIO( "OUT_PIO_READY", true );
             this.iO.WriteOutputIO( "OUT_PIO_READY", true );
@@ -907,51 +956,44 @@ namespace VehicleControlSystem.ControlLayer
             {
             {
                 PIOClear();
                 PIOClear();
                 loggerPIO.E( "[Port] - 2 Receive CV Run Timeout" );
                 loggerPIO.E( "[Port] - 2 Receive CV Run Timeout" );
-                this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
-                //return 0;
+                this.OccurVehicleAlarm( 26 );
+                return 0;
             }
             }
 
 
             this.iO.WriteOutputIO( "OUT_PIO_SENDING_RUN", true );
             this.iO.WriteOutputIO( "OUT_PIO_SENDING_RUN", true );
             loggerPIO.I( "[Vehicle] - 2 Send Run On" );
             loggerPIO.I( "[Vehicle] - 2 Send Run On" );
 
 
-            this.SetConveyorSpeed( true );
-            this.OnOffConveyor( true );
-            this.OnConveyorStart?.Invoke( false );
-
             var sTime = SwUtils.CurrentTimeMillis;
             var sTime = SwUtils.CurrentTimeMillis;
             while ( true )
             while ( true )
             {
             {
-                if ( SwUtils.Gt( sTime, 20 * ConstUtils.ONE_SECOND ) )
-                {
-                    PIOClear();
-                    this.OnOffConveyor( false, true );
-                    loggerPIO.E( "[Port] Conveyor Wait Time Out" );
-                    this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
+                Thread.Sleep( 5 );
 
 
-                    //if (IsDetectedLoadStart() || IsDetectedCenter()) //중간에 걸려 있다고 생각해서 알람 처리.
-                    //    return 12; //Conveyor Moving Timeout
-                    //else
-                    //    return 0;
-                }
+                if ( !this.iO.IsOn( "IN_PIO_READY" ) || this.iO.IsOn( "IN_PIO_RECEIVE_RUN" ) )
+                    break;
 
 
-                if ( this.iO.IsOn( "IN_PIO_RECEIVE_COMPLITE" ) )
+                if ( !sql.CommandDAL.HasK( this.CurrentSubCommand.CmdID ) )
+                {
+                    PIOClear();
+                    logger.D( "[Wait Charging] - 메인 명령 사라짐" );
                     break;
                     break;
+                }
             }
             }
 
 
-            if ( !IsDetectedCenter() )
-                this.OnCarrierDetected?.Invoke( false );
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_RECEIVE_COMPLITE" ) )
+            {
+                PIOClear();
+                loggerPIO.E( "[Port] - 3 Receive Complete Timeout" );
+                this.OccurVehicleAlarm( 26 );
+                return 0;
+            }
 
 
-            this.OnOffConveyor( false ); //Stop
-            this.OnConveyorStop?.Invoke( false );
             PIOClear();
             PIOClear();
 
 
             this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", true );
             this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", true );
-            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", false, 1000 );
-
-            this.OnUnloadComplete?.Invoke();
-
+            Thread.Sleep( 1000 );
+            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", false );
 
 
-            return true;
+            return 0;
         }
         }
 
 
         #endregion
         #endregion
@@ -995,17 +1037,17 @@ namespace VehicleControlSystem.ControlLayer
         /// (Run = true, CW = true CCW = false)
         /// (Run = true, CW = true CCW = false)
         /// </summary>
         /// </summary>
         /// <param name="isOn"></param>
         /// <param name="isOn"></param>
-        /// <param name="isCW"></param>
+        /// <param name="isLoad">bit On 시 Unload 방향 진행.</param>
         /// <returns></returns>
         /// <returns></returns>
-        int OnOffConveyor( bool isOn, bool isCW = false )
+        int OnOffConveyor( bool isOn, bool isLoad = false )
         {
         {
             if ( IsInverterError() )
             if ( IsInverterError() )
                 return 16;
                 return 16;
 
 
-            if ( isCW )
-                this.iO.OutputOn( "OUT_CV_CWCCW" );
-            else
+            if ( isLoad )
                 this.iO.OutputOff( "OUT_CV_CWCCW" );
                 this.iO.OutputOff( "OUT_CV_CWCCW" );
+            else
+                this.iO.OutputOn( "OUT_CV_CWCCW" );
 
 
             if ( isOn )
             if ( isOn )
                 this.iO.OutputOn( "OUT_CV_RUN" );
                 this.iO.OutputOn( "OUT_CV_RUN" );
@@ -1072,14 +1114,14 @@ namespace VehicleControlSystem.ControlLayer
             if ( !IsDetectedLoadStart() )
             if ( !IsDetectedLoadStart() )
                 return 11;
                 return 11;
 
 
-            OnOffConveyor( true, true );
+            OnOffConveyor( true, false );
 
 
             long sTime = SwUtils.CurrentTimeMillis;
             long sTime = SwUtils.CurrentTimeMillis;
             while ( true )
             while ( true )
             {
             {
                 if ( SwUtils.Gt( sTime, 20 * ConstUtils.ONE_SECOND ) ) //Wait 20Sec
                 if ( SwUtils.Gt( sTime, 20 * ConstUtils.ONE_SECOND ) ) //Wait 20Sec
                 {
                 {
-                    OnOffConveyor( false, true );
+                    OnOffConveyor( false, false );
                     return 12;
                     return 12;
                 }
                 }
 
 
@@ -1113,6 +1155,9 @@ namespace VehicleControlSystem.ControlLayer
             PIOClear();
             PIOClear();
             Thread.Sleep( 1000 );
             Thread.Sleep( 1000 );
             this.OnConveyorStop?.Invoke( true );
             this.OnConveyorStop?.Invoke( true );
+
+            Thread.Sleep( 1000 );
+            this.OnLoadComplete?.Invoke();
 #else
 #else
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
 
 
@@ -1235,6 +1280,7 @@ namespace VehicleControlSystem.ControlLayer
             this.OnConveyorStop?.Invoke( false );
             this.OnConveyorStop?.Invoke( false );
             PIOClear();
             PIOClear();
 
 
+            Thread.Sleep( 1000 );
             this.OnUnloadComplete?.Invoke();
             this.OnUnloadComplete?.Invoke();
 #else
 #else
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
@@ -1314,7 +1360,8 @@ namespace VehicleControlSystem.ControlLayer
             PIOClear();
             PIOClear();
 
 
             this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE" , true );
             this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE" , true );
-            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE" , false , 1000 );
+            Thread.Sleep( 1000 );
+            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE" , false );
 
 
             this.OnUnloadComplete?.Invoke();
             this.OnUnloadComplete?.Invoke();
 #endif
 #endif

+ 36 - 1
Dev/OHV/VehicleControlSystem/Managers/AutoManager.cs

@@ -9,6 +9,7 @@ using OHV.SqliteDAL;
 using OHV.Common.Model;
 using OHV.Common.Model;
 using OHV.Common.Events;
 using OHV.Common.Events;
 using VehicleControlSystem.ControlLayer;
 using VehicleControlSystem.ControlLayer;
+using GSG.NET.Utils;
 
 
 namespace VehicleControlSystem.Managers
 namespace VehicleControlSystem.Managers
 {
 {
@@ -23,7 +24,32 @@ namespace VehicleControlSystem.Managers
         bool isThreadAlive = false;
         bool isThreadAlive = false;
 
 
         IIO iO = null;
         IIO iO = null;
-        public bool IsErrorProcessing { get; set; } = false;
+
+        private bool isErrorProcessing = false;
+        public bool IsErrorProcessing 
+        { 
+            get { return this.isErrorProcessing; }
+            set
+            {
+                if ( this.isErrorProcessing == value ) return;
+                this.isErrorProcessing = value;
+                if ( value )
+                {
+                    if ( this.activeAlarm == null ) return;
+                    this.OnOccurAlarm?.BeginInvoke( this.activeAlarm.AlarmId, null, null );
+                }
+                else
+                {
+                    if ( this.activeAlarm == null ) return;
+                    this.OnClearAlarm?.BeginInvoke( this.activeAlarm.AlarmId, null, null );
+                    this.activeAlarm = null;
+                }
+            } 
+        }
+        public event Action<int> OnOccurAlarm;
+        public event Action<int> OnClearAlarm;
+        Alarm activeAlarm = null;
+
         IEventAggregator eventAggregator = null;
         IEventAggregator eventAggregator = null;
         SqliteManager sql = null;
         SqliteManager sql = null;
 
 
@@ -242,6 +268,7 @@ namespace VehicleControlSystem.Managers
         {
         {
             this.AutoModeStateProperty = eAutoModeState.ErrorStop;
             this.AutoModeStateProperty = eAutoModeState.ErrorStop;
             this.LampStateProperty = eLampState.Alarm;
             this.LampStateProperty = eLampState.Alarm;
+            this.BuzzerStateProperty = eBuzzerKind.Alarm;
 
 
             this.sql.CommandDAL.Clean();
             this.sql.CommandDAL.Clean();
             this.sql.SubCmdDAL.Clean();
             this.sql.SubCmdDAL.Clean();
@@ -252,6 +279,10 @@ namespace VehicleControlSystem.Managers
             {
             {
                 hisAlarm.AlarmId = alarmID;
                 hisAlarm.AlarmId = alarmID;
                 hisAlarm.Text = "Not Define Alarm";
                 hisAlarm.Text = "Not Define Alarm";
+
+                alarm = new Alarm();
+                alarm.AlarmId = alarmID;
+                alarm.Text = "Not Define Alarm";
             }
             }
             else
             else
             {
             {
@@ -266,6 +297,10 @@ namespace VehicleControlSystem.Managers
             if (IsErrorProcessing)
             if (IsErrorProcessing)
                 return;
                 return;
 
 
+            IsErrorProcessing = true;
+
+            this.activeAlarm = ObjectCopyUtils.DeepClone<Alarm>( alarm );
+
             var msg = new GUIMessageEventArgs
             var msg = new GUIMessageEventArgs
             {
             {
                 Kind = GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange,
                 Kind = GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange,

+ 73 - 26
Dev/OHV/VehicleControlSystem/Managers/HostManager.cs

@@ -1,8 +1,4 @@
 using System;
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using GSG.NET.Logging;
 using GSG.NET.Logging;
 using OHV.Common.Events;
 using OHV.Common.Events;
 using OHV.Common.Shareds;
 using OHV.Common.Shareds;
@@ -28,12 +24,64 @@ namespace VehicleControlSystem.Managers
         Vehicle vehicle;
         Vehicle vehicle;
         SqliteManager sql = null;
         SqliteManager sql = null;
 
 
-        public HostManager( IEventAggregator ea, Vehicle vehicle, SqliteManager sqlite, AutoManager autoManager )
+        public HostManager( IEventAggregator ea, Vehicle vehicle, SqliteManager sqlite, AutoManager autoManager, Scheduler scheduler )
         {
         {
             this.eventAggregator = ea;
             this.eventAggregator = ea;
             this.vehicle = vehicle;
             this.vehicle = vehicle;
             this.vehicle.PropertyChanged += Vehicle_PropertyChanged;
             this.vehicle.PropertyChanged += Vehicle_PropertyChanged;
             this.sql = sqlite;
             this.sql = sqlite;
+            autoManager.OnOccurAlarm += AutoManager_OnOccurAlarm;
+            autoManager.OnClearAlarm += AutoManager_OnClearAlarm;
+            scheduler.OnMaualAddedCommand += Scheduler_OnMaualAddedCommand;
+        }
+
+        private void Scheduler_OnMaualAddedCommand( Command obj )
+        {
+            var route = sql.RouteDal.GetRoute( obj.TargetID );
+            var msg = new OCSMessage()
+            {
+                Kind = eKind.P,
+                Tag = route.OCSMatchID,
+            };
+
+            switch ( obj.Type )
+            {
+                case eCommandType.Move:
+                    msg.SubCode = "001";
+                    break;
+                case eCommandType.MoveNLoad:
+                    msg.SubCode = "010";
+                    break;
+                case eCommandType.MoveNUnload:
+                    msg.SubCode = "100";
+                    break;
+                case eCommandType.Charging:
+                    msg.SubCode = "111";
+                    break;
+                default:
+                    break;
+            }
+
+            this.manager.Send( msg );
+
+        }
+
+        private void AutoManager_OnClearAlarm( int obj )
+        {
+            var msg = new OCSMessage();
+            msg.Kind = eKind.E;
+            msg.Tag = obj.ToString();
+            msg.SubCode = "100";
+            this.manager.Send( msg );
+        }
+
+        private void AutoManager_OnOccurAlarm( int obj )
+        {
+            var msg = new OCSMessage();
+            msg.Kind = eKind.E;
+            msg.Tag = obj.ToString();
+            msg.SubCode = "101";
+            this.manager.Send( msg );
         }
         }
 
 
         private void Vehicle_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
         private void Vehicle_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
@@ -96,10 +144,10 @@ namespace VehicleControlSystem.Managers
 
 
             vehicle.OnCurrentTagChanged += Vehicle_OnCurrentTagChanged;
             vehicle.OnCurrentTagChanged += Vehicle_OnCurrentTagChanged;
 
 
-            vehicle.OnManualLoad += Vehicle_OnManualLoad;
-            vehicle.OnManualMove += Vehicle_OnManualMove;
-            vehicle.OnManualUnload += Vehicle_OnManualUnload;
-            vehicle.OnManualCharging += Vehicle_OnManualCharging;
+            //vehicle.OnManualLoad += Vehicle_OnManualLoad;
+            //vehicle.OnManualMove += Vehicle_OnManualMove;
+            //vehicle.OnManualUnload += Vehicle_OnManualUnload;
+            //vehicle.OnManualCharging += Vehicle_OnManualCharging;
 
 
             vehicle.OnPIOStart += Vehicle_OnPIOStart;
             vehicle.OnPIOStart += Vehicle_OnPIOStart;
             vehicle.OnConveyorStart += Vehicle_OnConveyorStart;
             vehicle.OnConveyorStart += Vehicle_OnConveyorStart;
@@ -249,25 +297,25 @@ namespace VehicleControlSystem.Managers
             this.manager.Send( msg );
             this.manager.Send( msg );
         }
         }
 
 
-        private void Vehicle_OnManualCharging()
-        {
-            this.Send_ManualCharging();
-        }
+        //private void Vehicle_OnManualCharging()
+        //{
+        //    this.Send_ManualCharging();
+        //}
 
 
-        private void Vehicle_OnManualUnload()
-        {
-            this.Send_ManualUnlaod();
-        }
+        //private void Vehicle_OnManualUnload()
+        //{
+        //    this.Send_ManualUnlaod();
+        //}
 
 
-        private void Vehicle_OnManualMove()
-        {
-            this.Send_ManualMove();
-        }
+        //private void Vehicle_OnManualMove()
+        //{
+        //    this.Send_ManualMove();
+        //}
 
 
-        private void Vehicle_OnManualLoad()
-        {
-            this.Send_ManualLoad();
-        }
+        //private void Vehicle_OnManualLoad()
+        //{
+        //    this.Send_ManualLoad();
+        //}
 
 
         private void Vehicle_OnCurrentTagChanged( string point )
         private void Vehicle_OnCurrentTagChanged( string point )
         {
         {
@@ -501,7 +549,6 @@ namespace VehicleControlSystem.Managers
             this.manager.Send( msg );
             this.manager.Send( msg );
         }
         }
 
 
-
         public void Send_Ccmd( string crossPointID )
         public void Send_Ccmd( string crossPointID )
         {
         {
             var msg = new OCSMessage();
             var msg = new OCSMessage();

+ 63 - 0
Dev/OHV/VehicleControlSystem/Managers/RouteManager.cs

@@ -0,0 +1,63 @@
+using GSG.NET.FileSystem;
+using OHV.Common.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Json;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VehicleControlSystem.Managers
+{
+    public class RouteManager
+    {
+        public List<RoutePoint> RoutePoints { get; set; } = new List<RoutePoint>();
+        public string Path { get; set; }
+
+        public RouteManager(string path)
+        {
+            this.Path = path;
+        }
+
+        public bool LoadRoute()
+        {
+            if ( !System.IO.File.Exists( this.Path + "\\Route.json" ) ) return false;
+
+            string strReturn = System.IO.File.ReadAllText( this.Path + "\\Route.json" );
+            JsonTextParser jtr = new JsonTextParser();
+            JsonObject jo = jtr.Parse( strReturn );
+
+            JsonObjectCollection jac = (JsonObjectCollection)jo;
+
+            return true;
+        }
+
+        public bool SaveRoute()
+        {
+            if ( System.IO.File.Exists( this.Path + "\\Route.json" ) ) return false;
+
+            List<RoutePoint> ll = new List<RoutePoint>();
+            ll.Add( new RoutePoint
+            {
+                Name = "1000",
+                NextRoutes = new List<string>() { "1001" },
+                PreRoutes = new List<string>() { "1100" },
+                SegmentsID = new List<string>() { "S001"},
+                Type  = ePointType.Road
+            } );
+
+            List<RouteSegment> sll = new List<RouteSegment>();
+            sll.Add( new RouteSegment
+            {
+                From = eRoadForm.Straight,
+                Name = "S001",
+                Length = 1000,
+                MaxSpeed = 100,
+            } );
+
+
+            return true;
+        }
+
+    }
+}

+ 13 - 8
Dev/OHV/VehicleControlSystem/Managers/Scheduler.cs

@@ -34,6 +34,8 @@ namespace VehicleControlSystem.Managers
         AutoManager autoManager;
         AutoManager autoManager;
         SqliteManager sql = null;
         SqliteManager sql = null;
 
 
+        public event Action<Command> OnMaualAddedCommand;
+
         public Scheduler( IEventAggregator ea, AutoManager autoManager, SqliteManager sqlite )
         public Scheduler( IEventAggregator ea, AutoManager autoManager, SqliteManager sqlite )
         {
         {
             this.CommandsList = new List<Command>();
             this.CommandsList = new List<Command>();
@@ -46,11 +48,16 @@ namespace VehicleControlSystem.Managers
 
 
         private void OnReceivedMessageEvent( VCSMessageEventArgs obj )
         private void OnReceivedMessageEvent( VCSMessageEventArgs obj )
         {
         {
-            var vInof = sql.VehicleInfoDAL.GetInfo();
-            if ( vInof.VehicleState == OHV.Common.Shareds.eVehicleState.Move )
-                this.sql.CommandDAL.Clean();
+            if ( obj.Kind == VCSMessageEventArgs.eVCSMessageKind.ReqAddCommand )
+            {
+                //var vInof = sql.VehicleInfoDAL.GetInfo();
+                //if ( vInof.VehicleState == OHV.Common.Shareds.eVehicleState.Move )
+                //    this.sql.CommandDAL.Clean();
 
 
-            this.AddCommand( obj.Command );
+                this.AddCommand( obj.Command );
+                if ( obj.Command.ByWho == OHV.Common.Shareds.eCommandByWho.LocalSystem || obj.Command.ByWho == OHV.Common.Shareds.eCommandByWho.LocalOverWrite )
+                    this.OnMaualAddedCommand?.BeginInvoke( obj.Command, null, null );
+            }
 
 
             //var m = new GUIMessageEventArgs() { MessageText = obj.MessageText, MessageKey = obj.MessageKey };
             //var m = new GUIMessageEventArgs() { MessageText = obj.MessageText, MessageKey = obj.MessageKey };
             //m.Command = ObjectCopyUtils.DeepClone(obj.Command);
             //m.Command = ObjectCopyUtils.DeepClone(obj.Command);
@@ -70,10 +77,9 @@ namespace VehicleControlSystem.Managers
 
 
         public bool AddCommand( Command cmd )
         public bool AddCommand( Command cmd )
         {
         {
-            if ( this.CommandsList == null ) return false;
             try
             try
             {
             {
-                this.CommandsList.Add( cmd );
+                this.sql.CommandDAL.Add( cmd );
             }
             }
             catch ( Exception ex )
             catch ( Exception ex )
             {
             {
@@ -154,9 +160,8 @@ namespace VehicleControlSystem.Managers
                             case OHV.Common.Shareds.eCommandType.Move:
                             case OHV.Common.Shareds.eCommandType.Move:
                             case OHV.Common.Shareds.eCommandType.MoveNLoad:
                             case OHV.Common.Shareds.eCommandType.MoveNLoad:
                             case OHV.Common.Shareds.eCommandType.MoveNUnload:
                             case OHV.Common.Shareds.eCommandType.MoveNUnload:
-                                CreateSubCommand( cmd, SubCmd.eType.Move );
-                                break;
                             case OHV.Common.Shareds.eCommandType.Charging:
                             case OHV.Common.Shareds.eCommandType.Charging:
+                                CreateSubCommand( cmd, SubCmd.eType.Move );
                                 break;
                                 break;
                             default:
                             default:
                                 break;
                                 break;

+ 20 - 3
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -6,6 +6,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using GSG.NET;
 using GSG.NET;
 using GSG.NET.Extensions;
 using GSG.NET.Extensions;
+using GSG.NET.Logging;
 using GSG.NET.ObjectBase;
 using GSG.NET.ObjectBase;
 using GSG.NET.Quartz;
 using GSG.NET.Quartz;
 using OHV.Common.Events;
 using OHV.Common.Events;
@@ -24,6 +25,8 @@ namespace VehicleControlSystem
     [Module(ModuleName = "VCSystem")]
     [Module(ModuleName = "VCSystem")]
     public class VCSystem : IModule, IDisposable
     public class VCSystem : IModule, IDisposable
     {
     {
+        Logger logger = Logger.GetLogger();
+
         Scheduler scheduler = null;
         Scheduler scheduler = null;
         IEventAggregator eventAggregator = null;
         IEventAggregator eventAggregator = null;
         public IIO IO = null;
         public IIO IO = null;
@@ -64,7 +67,7 @@ namespace VehicleControlSystem
             this.vehicle = new Vehicle(this.IO, this.sql, this.eventAggregator, this.autoManager);
             this.vehicle = new Vehicle(this.IO, this.sql, this.eventAggregator, this.autoManager);
             this.vehicle.PropertyChanged += Vehicle_PropertyChanged;
             this.vehicle.PropertyChanged += Vehicle_PropertyChanged;
 
 
-            this.hostManager = new HostManager(this.eventAggregator, this.vehicle, this.sql, this.autoManager);
+            this.hostManager = new HostManager(this.eventAggregator, this.vehicle, this.sql, this.autoManager, this.scheduler);
 
 
             this.hostManager.Init();
             this.hostManager.Init();
             this.vehicle.Init();
             this.vehicle.Init();
@@ -108,7 +111,7 @@ namespace VehicleControlSystem
         }
         }
         #endregion
         #endregion
 
 
-        #region RspMessage Method
+        #region ReqMessage Method
         void ReceivedMessageEvent(VCSMessageEventArgs msg)
         void ReceivedMessageEvent(VCSMessageEventArgs msg)
         {
         {
             switch ( msg.Kind )
             switch ( msg.Kind )
@@ -139,13 +142,27 @@ namespace VehicleControlSystem
                     ReqBuzzerStop();
                     ReqBuzzerStop();
                     break;
                     break;
                 case VCSMessageEventArgs.eVCSMessageKind.ReqMachineModeChg:
                 case VCSMessageEventArgs.eVCSMessageKind.ReqMachineModeChg:
-                    ReqMachineModeChg(msg);
+                    ReqMachineModeChg( msg );
+                    break;
+                case VCSMessageEventArgs.eVCSMessageKind.ReqAddCommand:
+                    break;
+                case VCSMessageEventArgs.eVCSMessageKind.ReqTest:
+                    ReqTest();
                     break;
                     break;
                 default:
                 default:
                     break;
                     break;
             }
             }
         }
         }
 
 
+        private void ReqTest()
+        {
+            logger.D( "Test Request" );
+            if ( this.IO.WaitChangeInputIO( true, 30000, "IN_CV_DETECT_00" ) )
+                logger.D( "Test - Time in" );
+            else
+                logger.D( "Test - Time out" );
+        }
+
         private void ReqMachineModeChg( VCSMessageEventArgs msg )
         private void ReqMachineModeChg( VCSMessageEventArgs msg )
         {
         {
             var reply = new GUIMessageEventArgs();
             var reply = new GUIMessageEventArgs();