Pārlūkot izejas kodu

TSDI 현장 업데이트

ys-hwang 6 gadi atpakaļ
vecāks
revīzija
fa7845e8ce
27 mainītis faili ar 598 papildinājumiem un 195 dzēšanām
  1. 1 0
      Dev/OHV/OHV.LanguageHalper/Languages/English.xaml.cs
  2. 18 0
      Dev/OHV/OHV.Module.Interactivity/MessageController.cs
  3. 8 0
      Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj
  4. 59 0
      Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBar.xaml
  5. 41 0
      Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBar.xaml.cs
  6. 132 0
      Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBarViewModel.cs
  7. 25 18
      Dev/OHV/OHV.Module.Interactivity/PopUp/ConveyorControlViewModel.cs
  8. 41 30
      Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoViewModel.cs
  9. 2 2
      Dev/OHV/OHV.Module.ListViews/Views/CommandListView.xaml
  10. 9 9
      Dev/OHV/OHV.Module.ListViews/Views/SubCommandListView.xaml
  11. 0 8
      Dev/OHV/OHV.Module.ListViews/Views/SubCommandListView.xaml.cs
  12. 13 9
      Dev/OHV/OHV.Module.ListViews/Views/SubCommandListViewModel.cs
  13. 0 1
      Dev/OHV/OHV.Module.MainViews/Views/HistoryViewModel.cs
  14. 4 4
      Dev/OHV/OHV.SqliteDAL/OHVDbInitializer.cs
  15. 81 48
      Dev/OHV/OHV.Vehicle/Concept/D_MainWindow.xaml
  16. 41 8
      Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs
  17. 2 0
      Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs
  18. 37 2
      Dev/OHV/VehicleControlSystem/ControlLayer/MQ/ZmqManager.cs
  19. 45 24
      Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs
  20. 2 1
      Dev/OHV/VehicleControlSystem/Managers/Scheduler.cs
  21. 27 19
      Dev/OHV/VehicleControlSystem/VCSystem.cs
  22. 1 1
      Dev/OHV/VehicleControlSystem/VehicleControlSystem.csproj
  23. 2 1
      Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/App.config
  24. 4 8
      Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FTPLogger.cs
  25. 1 0
      Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FormMain.Designer.cs
  26. 2 2
      Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger.csproj
  27. BIN
      Documents/DirveInterface/mahaOHV_communication-v0.2.xlsx

+ 1 - 0
Dev/OHV/OHV.LanguageHalper/Languages/English.xaml.cs

@@ -9,6 +9,7 @@ namespace OHV.LanguageHelper.Languages
 {
     public partial class English : ResourceDictionary
     {
+        
         public English()
         {
             InitializeComponent();

+ 18 - 0
Dev/OHV/OHV.Module.Interactivity/MessageController.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using MaterialDesignThemes.Wpf;
 using OHV.Common.Shareds;
 using OHV.Module.Interactivity.PopUp;
 using Prism.Interactivity.InteractionRequest;
@@ -39,6 +40,7 @@ namespace OHV.Module.Interactivity
             containerRegistry.RegisterDialog<InOutControlView , InOutControlViewModel>();
             containerRegistry.RegisterDialog<ConfigView, ConfigViewModel>();
             containerRegistry.RegisterDialog<ConveyorControlView , ConveyorControlViewModel>();
+            containerRegistry.RegisterDialog<BusyBar, BusyBarViewModel>();
         }
 
         public void ShowPopupView(ePopupType type, string message = null, bool isOk = true)
@@ -97,5 +99,21 @@ namespace OHV.Module.Interactivity
         {
             this.dialogService.ShowDialog( "ConfirmationPopupView" , new DialogParameters( $"message={Message}" ) , callBack );
         }
+
+
+        public BusyBar busy = new BusyBar();
+        public void ShowBusyBar(string title, string text)
+        {
+            var dialogParam = new DialogParameters();
+            {
+                dialogParam.Add("Title", title);
+                dialogParam.Add("Text", text);
+            }
+
+            this.dialogService.ShowDialog("BusyBar", dialogParam, null);
+            //this.busy.ShowDialog("");
+        }
+
+
     }
 }

+ 8 - 0
Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj

@@ -124,6 +124,10 @@
     <Compile Include="PopUp\BatteryConfigViewModel.cs">
       <DependentUpon>BatteryConfigView.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PopUp\BusyBar.xaml.cs">
+      <DependentUpon>BusyBar.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="PopUp\BusyBarViewModel.cs" />
     <Compile Include="PopUp\CalcuratorView.xaml.cs">
       <DependentUpon>CalcuratorView.xaml</DependentUpon>
     </Compile>
@@ -199,6 +203,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="PopUp\BusyBar.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="PopUp\CalcuratorView.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 59 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBar.xaml

@@ -0,0 +1,59 @@
+<UserControl x:Class="OHV.Module.Interactivity.PopUp.BusyBar"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:OHV.Module.Interactivity.PopUp"
+             xmlns:prism="http://prismlibrary.com/"
+             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d" 
+             Height="250" Width="450"
+             >
+
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="Window">
+            <Setter Property="Topmost" Value="True"/>
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="Background" Value="Transparent"/>
+            <Setter Property="AllowsTransparency" Value="True"/>
+            <Setter Property="ResizeMode" Value="NoResize"/>
+            <Setter Property="WindowStyle" Value="None"/>
+            <Setter Property="BorderThickness" Value="1"/>
+            <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
+            <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
+
+            <!--<Style.Triggers>
+                <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
+                    <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
+                </Trigger>
+            </Style.Triggers>-->
+        </Style>
+    </prism:Dialog.WindowStyle>
+
+    <Border BorderBrush="DodgerBlue" BorderThickness="1" CornerRadius="20" Background="#263238" Height="250" Width="450" Focusable="True">
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height=".7*"/>
+                <!--<RowDefinition Height="*"/>-->
+            </Grid.RowDefinitions>
+
+            <Grid Grid.Row="0">
+                <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
+                    <TextBlock Text="{Binding Title, FallbackValue=Title}" FontSize="30" HorizontalAlignment="Center" Foreground="Orange"/>
+                    <TextBlock Text="{Binding Text, FallbackValue=Text}" FontSize="20" HorizontalAlignment="Center" Foreground="Orange"/>
+                </StackPanel>
+            </Grid>
+
+            <Grid Grid.Row="1">
+                <Border BorderBrush="Gray" BorderThickness="1"/>
+                <ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}" Background="{x:Null}"
+                         VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
+                         Foreground="DodgerBlue" Value="{Binding ProgressValue, FallbackValue=0}" IsIndeterminate="False" Height="50" Width="50" BorderBrush="DodgerBlue"/>
+            </Grid>
+
+            <!--<Grid Grid.Row="2"></Grid>-->
+        </Grid>
+    </Border>
+</UserControl>

+ 41 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBar.xaml.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace OHV.Module.Interactivity.PopUp
+{
+    /// <summary>
+    /// BusyBar.xaml에 대한 상호 작용 논리
+    /// </summary>
+    public partial class BusyBar : UserControl
+    {
+        BusyBarViewModel ViewModel { get => this.DataContext as BusyBarViewModel; }
+        public BusyBar()
+        {
+            InitializeComponent();
+
+            this.Loaded += BusyBar_Loaded;
+        }
+
+        private void BusyBar_Loaded(object sender, RoutedEventArgs e)
+        {
+            this.ViewModel.Init();
+        }
+
+        public void SetBusyState(bool state)
+        {
+            this.ViewModel.IsBusy = state;
+        }
+    }
+}

+ 132 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/BusyBarViewModel.cs

@@ -0,0 +1,132 @@
+using GSG.NET.Utils;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Threading;
+
+namespace OHV.Module.Interactivity.PopUp
+{
+    public class BusyBarViewModel : BindableBase, IDialogAware
+    {
+        private DelegateCommand<string> _closeDialogCommand;
+
+        public event Action<IDialogResult> RequestClose;
+
+        public DelegateCommand<string> CloseDialogCommand =>
+            _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));
+
+        //public string Title => throw new NotImplementedException();
+
+        #region Property
+        private string text = "Waiting. . .";
+
+        public string Text
+        {
+            get { return text; }
+            set { SetProperty(ref this.text, value); }
+        }
+
+        private string title = "Device";
+
+        public string Title
+        {
+            get { return title; }
+            set { SetProperty(ref this.title, value); }
+        }
+
+        private bool isBusy;
+
+        public bool IsBusy
+        {
+            get { return isBusy; }
+            set { SetProperty(ref this.isBusy , value); }
+        }
+
+        #endregion
+
+        public BusyBarViewModel()
+        {
+
+        }
+
+        public void Init() { }
+        
+        #region Dialog Function
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        private int progressValue;
+
+        public int ProgressValue
+        {
+            get { return progressValue; }
+            set { SetProperty(ref this.progressValue , value); }
+        }
+
+
+        public void OnDialogClosed()
+        {
+        }
+
+        DispatcherTimer busyTimer;
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            //this.ConfigListProperty = sql.ConfigDal.GetAll().ToList();
+
+            this.Title = parameters.GetValue<string>("Title");
+            this.Text = parameters.GetValue<string>("Text");
+
+            var sw = SwUtils.CurrentTimeMillis;
+
+            busyTimer = new DispatcherTimer();
+            busyTimer.Tick += (object sender, EventArgs e) =>
+            {
+                if (SwUtils.Gt(sw, 10000))
+                {
+                    this.IsBusy = false;
+                    this.CloseDialog("");
+                }
+
+                if (this.IsBusy)
+                {
+                    this.IsBusy = false;
+                    this.CloseDialog("");
+                }
+
+                this.ProgressValue += 5;
+            };
+            busyTimer.Interval = TimeSpan.FromMilliseconds(200);
+            busyTimer.Start();
+        }
+
+        private void CloseDialog(string parameter)
+        {
+            ButtonResult result = ButtonResult.None;
+
+            if (parameter?.ToLower() == "true")
+                result = ButtonResult.OK;
+            else if (parameter?.ToLower() == "false")
+                result = ButtonResult.Cancel;
+
+            result = ButtonResult.OK;
+            RaiseRequestClose(new DialogResult(result));
+        }
+
+        public virtual void RaiseRequestClose(IDialogResult dialogResult)
+        {
+            this.busyTimer.Stop();
+            this.busyTimer = null;
+
+            RequestClose?.Invoke(dialogResult);
+        }
+        #endregion
+    }
+}

+ 25 - 18
Dev/OHV/OHV.Module.Interactivity/PopUp/ConveyorControlViewModel.cs

@@ -157,6 +157,28 @@ namespace OHV.Module.Interactivity.PopUp
 
         }
 
+        void UpdateCvState()
+        {
+            if (IO.IsOn("OUT_CV_RUN", false))
+            {
+                if (IO.IsOn("OUT_CV_CWCCW", false))
+                {
+                    this.CWOnBrush = Brushes.DodgerBlue;
+                    this.CCWOnBrush = Brushes.LimeGreen;
+                }
+                else
+                {
+                    this.CWOnBrush = Brushes.LimeGreen;
+                    this.CCWOnBrush = Brushes.DodgerBlue;
+                }
+            }
+            else
+            {
+                this.CWOnBrush = Brushes.DodgerBlue;
+                this.CCWOnBrush = Brushes.DodgerBlue;
+            }
+        }
+
         private void ExecutePIOChargeCommand(string obj)
         {
             this.messageController.ShowConfirmationPopupView($"PIO Battery Charge ?", r =>
@@ -228,24 +250,7 @@ namespace OHV.Module.Interactivity.PopUp
         {
             if (bit.Tag.Equals("OUT_CV_RUN"))
             {
-                if (IO.IsOn("OUT_CV_RUN", false))
-                {
-                    if (IO.IsOn("OUT_CV_CWCCW", false))
-                    {
-                        this.CWOnBrush = Brushes.DodgerBlue;
-                        this.CCWOnBrush = Brushes.LimeGreen;
-                    }
-                    else
-                    {
-                        this.CWOnBrush = Brushes.LimeGreen;
-                        this.CCWOnBrush = Brushes.DodgerBlue;
-                    }
-                }
-                else
-                {
-                    this.CWOnBrush = Brushes.DodgerBlue;
-                    this.CCWOnBrush = Brushes.DodgerBlue;
-                }
+                this.UpdateCvState();
             }
         }
 
@@ -461,6 +466,8 @@ namespace OHV.Module.Interactivity.PopUp
             this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish(msg);
 
             this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack, Kind = AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition });
+
+            this.UpdateCvState();
         }
 
 

+ 41 - 30
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoViewModel.cs

@@ -1,5 +1,7 @@
-using GSG.NET.Extensions;
+using GSG.NET.Concurrent;
+using GSG.NET.Extensions;
 using GSG.NET.Utils;
+using MaterialDesignThemes.Wpf;
 using OHV.Common.Events;
 using OHV.Common.Model;
 using OHV.Common.Shareds;
@@ -17,6 +19,7 @@ using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
 using VehicleControlSystem;
+using VehicleControlSystem.ControlLayer;
 using VehicleControlSystem.ControlLayer.MQ;
 
 namespace OHV.Module.Interactivity.PopUp
@@ -228,13 +231,12 @@ namespace OHV.Module.Interactivity.PopUp
             this.JogVelPopupCommand = new DelegateCommand( ExecuteJogVelPopupCommand );
             this.JogCommand = new DelegateCommand<object>( ExecuteJogCommand );
 
-            this.InitializeData();
         }
 
         private void InitializeData()
         {
             this.CurrentMCR = this.zmqManager.CurrentMCR;
-            this.CurrentTag = this.zmqManager.GetCurrentPointNo().ToString();
+            this.CurrentTag = this.zmqManager.CurrentPointNo.ToString();
 
             this.DriveAutoReadyState( this.zmqManager.IsCanStanbyLocation );
             this.UpdateDriveState( this.zmqManager.DriveState );
@@ -278,24 +280,15 @@ namespace OHV.Module.Interactivity.PopUp
 
                 case "IsCanStanbyLocation":
                     {
-                        var ll = CastTo<bool>.From<object>( newValue );
-                        DriveAutoReadyState( ll );
+                        var result = CastTo<bool>.From<object>( newValue );
+                        DriveAutoReadyState( result );
                     }
                     break;
-                //case "IsDriveOn":
-                //    {
-                //        var result = CastTo<bool>.From<object>( newValue );
-                //        if ( result )
-                //            this.DriveOnStateBrush = Brushes.LimeGreen;
-                //        else
-                //            this.DriveOnStateBrush = Brushes.DodgerBlue;
-                //    }
-                //    break;
 
                 case "DriveState":
                     {
-                        var ll = CastTo<eDriveState>.From<object>( newValue );
-                        this.UpdateDriveState( ll );
+                        var result = CastTo<eDriveState>.From<object>( newValue );
+                        this.UpdateDriveState( result );
                     }
                     break;
 
@@ -435,11 +428,26 @@ namespace OHV.Module.Interactivity.PopUp
                     case DriveControlEventArgs.eControlKind.ReqCurrentPos:
                         this.CurrentPosition = args.CurrentPosition;
                         break;
+                         
                     case DriveControlEventArgs.eControlKind.ReqStopCurrentPos:
                         break;
                     case DriveControlEventArgs.eControlKind.FaultReset:
+                        if (args.Result.IsSuccess)
+                            this.messageController.ShowNotificationView("Fault Reset Success");
+                        else
+                            this.messageController.ShowNotificationView("Fault Reset Fail", false);
                         break;
                     case DriveControlEventArgs.eControlKind.DriveON:
+                        if (args.Result.IsSuccess)
+                        {
+                            this.messageController.ShowNotificationView("Drive On Success");
+                            LockUtils.Wait(300);
+                            this.messageController.busy.SetBusyState(true);
+                        }
+                        else
+                        {
+                            //this.messageController.ShowNotificationView("Drive On Fail", false);
+                        }
                         break;
                     case DriveControlEventArgs.eControlKind.DriveOFF:
                         break;
@@ -542,21 +550,21 @@ namespace OHV.Module.Interactivity.PopUp
 
         private void ExecutePositionSaveCommand()
         {
-            this.messageController.ShowConfirmationPopupView( "Save To Data ?" , r =>
-              {
-                  if ( r.Result == ButtonResult.OK )
-                  {
-                      var result = this.RouteList.Any( x => x.IsSelected != false );
+            this.messageController.ShowConfirmationPopupView("Save To Data ?", r =>
+            {
+                if (r.Result == ButtonResult.OK)
+                {
+                    var result = this.RouteList.Any(x => x.IsSelected != false);
 
-                      if ( !result )
-                      {
-                          this.messageController.ShowNotificationView( "Pos Not Selected" );
-                          return;
-                      }
+                    if (!result)
+                    {
+                        this.messageController.ShowNotificationView("Pos Not Selected");
+                        return;
+                    }
 
-                      var ll = this.RouteList.Where( x => x.IsSelected ).FirstOrDefault();
-                  }
-              } );
+                    var ll = this.RouteList.Where(x => x.IsSelected).FirstOrDefault();
+                }
+            });
         }
 
         private void ExecutePositionDeleteCommand()
@@ -638,6 +646,7 @@ namespace OHV.Module.Interactivity.PopUp
             };
 
             this.PublishEvent( msg );
+            this.messageController.ShowBusyBar("Batch Command", "Wait DriveOn..");
         }
 
         private void ExecuteCurrentToTargetCommand()
@@ -717,7 +726,9 @@ namespace OHV.Module.Interactivity.PopUp
                 var sT = SwUtils.CurrentTimeMillis;
                 this.RouteList = new ObservableCollection<Route>( sql.RouteDal.GetAll() );
                 Console.WriteLine( SwUtils.Elapsed( sT ) );
-            } );
+
+                this.InitializeData();
+            });
 
             await task;
         }

+ 2 - 2
Dev/OHV/OHV.Module.ListViews/Views/CommandListView.xaml

@@ -79,12 +79,12 @@
                         </DataGridTemplateColumn.CellTemplate>
                     </DataGridTemplateColumn>
 
+                    <materialDesign:DataGridTextColumn Header="CreateTime" Binding="{Binding CreateTime}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="PointID" Binding="{Binding TargetID}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="EQ" Binding="{Binding TargetName}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="Type" Binding="{Binding Type}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="State" Binding="{Binding State}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
-                    <materialDesign:DataGridTextColumn Header="CreateTime" Binding="{Binding CreateTime}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
-                    <materialDesign:DataGridTextColumn Header="CommandID" Binding="{Binding CommandID}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
+                    <!--<materialDesign:DataGridTextColumn Header="CommandID" Binding="{Binding CommandID}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>-->
 
                 </DataGrid.Columns>
             </DataGrid>

+ 9 - 9
Dev/OHV/OHV.Module.ListViews/Views/SubCommandListView.xaml

@@ -67,7 +67,7 @@
                         <Setter Property="VerticalContentAlignment" Value="Center"/>
                         <Setter Property="HorizontalContentAlignment" Value="Center"/>
                         <Setter Property="Foreground" Value="White"/>
-                        <Setter Property="FontSize" Value="20"/>
+                        <Setter Property="FontSize" Value="17"/>
                     </Style>
                 </DataGrid.Resources>
 
@@ -80,10 +80,10 @@
                         </DataGridTemplateColumn.CellTemplate>
                     </DataGridTemplateColumn>
 
-                    <materialDesign:DataGridTextColumn Header="ID" Binding="{Binding ID}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
+                    <!--<materialDesign:DataGridTextColumn Header="ID" Binding="{Binding ID}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>-->
+                    <materialDesign:DataGridTextColumn Header="CreateTime" Binding="{Binding CreateTime}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="Type" Binding="{Binding Type}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
                     <materialDesign:DataGridTextColumn Header="State" Binding="{Binding State}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
-                    <materialDesign:DataGridTextColumn Header="CreateTime" Binding="{Binding CreateTime}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}"></materialDesign:DataGridTextColumn>
 
                 </DataGrid.Columns>
             </DataGrid>
@@ -109,8 +109,8 @@
                         </Grid.ColumnDefinitions>
                         <TextBlock Text="ID" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center" />
                         <TextBlock Grid.Column="1" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding SelectedSubCmdID, Mode=OneWay}"/>
-                        <!--<ComboBox ItemsSource="{Binding TargetIDList}" SelectedItem="{Binding TargetID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  Grid.Column="1">
-                        </ComboBox>-->
+                        <ComboBox ItemsSource="{Binding TargetIDList}" SelectedItem="{Binding TargetID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  Grid.Column="1">
+                        </ComboBox>
                     </Grid>
 
                     <Grid Margin="0,10,0,0" Grid.Row="1" Height="25">
@@ -118,16 +118,16 @@
                             <ColumnDefinition Width="120"/>
                             <ColumnDefinition Width="*"/>
                         </Grid.ColumnDefinitions>
-                        <!--<TextBlock Text="Type" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center"/>
+                        <TextBlock Text="Type" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center"/>
                         <ComboBox ItemsSource="{Binding Source={StaticResource SubCommandType}}" SelectedItem="{Binding SelectedCommandType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  Grid.Column="1">
-                        </ComboBox>-->
-                        <!--<TextBlock Grid.Column="1" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding SelectedSubCmdType, Mode=OneWay}"/>-->
+                        </ComboBox>
+                        <TextBlock Grid.Column="1" Style="{DynamicResource MaterialDesignTextBlock}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding SelectedSubCmdType, Mode=OneWay}"/>
                     </Grid>
 
                 </Grid>
 
                 <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2" VerticalAlignment="Top" Margin="0,15,0,0">
-                    <!--<Button Height="45" Content="Add" Command="{Binding AddCommand}" Width="100" Margin="0,0,10,0"/>-->
+                    <Button Height="45" Content="Add" Command="{Binding AddCommand}" Width="100" Margin="0,0,10,0"/>
                     <Button Height="45" Content="Delete" Command="{Binding DeleteCommand}" Width="100"/>
                 </StackPanel>
             </Grid>

+ 0 - 8
Dev/OHV/OHV.Module.ListViews/Views/SubCommandListView.xaml.cs

@@ -23,14 +23,6 @@ namespace OHV.Module.ListViews.Views
         public SubCommandListView()
         {
             InitializeComponent();
-
-            this.Unloaded += SubCommandListView_Unloaded;
-        }
-
-        private void SubCommandListView_Unloaded(object sender, RoutedEventArgs e)
-        {
-            var viewModel = this.DataContext as SubCommandListViewModel;
-            viewModel.Dispose();
         }
     }
 }

+ 13 - 9
Dev/OHV/OHV.Module.ListViews/Views/SubCommandListViewModel.cs

@@ -76,7 +76,7 @@ namespace OHV.Module.ListViews.Views
 
         internal void Dispose()
         {
-            this.sql.SubCmdDAL.OnChangeTable -= SubCmdDAL_ChangedProperty;
+            //this.sql.SubCmdDAL.OnChangeTable -= SubCmdDAL_ChangedProperty;
             this.eventAggregator.GetEvent<VehicleSubCmdListChanged>().Unsubscribe(UICallbackCommunication);
         }
 
@@ -92,18 +92,22 @@ namespace OHV.Module.ListViews.Views
 
         private void ExecuteAddCommand( )
         {
-            //var route = sql.RouteDal.GetRoute( TargetID );
-            //if ( route == null )
-            //    messageController.ShowNotificationView( "Not Found TargetID" );
+            //var route = sql.RouteDal.GetById(TargetID);
+            //if (route == null)
+            //    return;
+            ////messageController.ShowNotificationView("Not Found TargetID");
             //else
             //{
-            //    SubCmd cmd = new SubCmd() { TargetID = TargetID , Type = SelectedCommandType };
+                SubCmd cmd = new SubCmd() { TargetID = TargetID, Type = SelectedCommandType };
 
-            //    var msg = new VCSMessageEventArgs();
-            //    msg.Kind = VCSMessageEventArgs.eVCSMessageKind.ReqAddCommand;
-            //    msg.Command = cmd;
+                var msg = new VCSMessageEventArgs();
+                msg.Kind = VCSMessageEventArgs.eVCSMessageKind.ReqAddCommand;
+               // msg.Command = cmd;
 
-            //    this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( msg );
+                msg.Arg = cmd;
+
+                //this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish(msg);
+                this.sql.SubCmdDAL.Insert(cmd);
             //}
 
             //UI 초기화

+ 0 - 1
Dev/OHV/OHV.Module.MainViews/Views/HistoryViewModel.cs

@@ -42,7 +42,6 @@ namespace OHV.Module.MainViews.Views
 
         private void HisAlarmDAL_ChangedProperty()
         {
-            //TODO: AlarmList Null Exception 발생함.
            if ( this.AlarmList == null )
                 return;
 

+ 4 - 4
Dev/OHV/OHV.SqliteDAL/OHVDbInitializer.cs

@@ -25,7 +25,7 @@ namespace OHV.SqliteDAL
                 {
                     ID = ConstString.Addr,
                     Name = ConstString.Addr,
-                    Value = "127.0.0.1",
+                    Value = "109.19.26.163",
                     Desc = "OCS Address",
                     EditTime = DateTime.Now
                 },
@@ -57,7 +57,7 @@ namespace OHV.SqliteDAL
                 {
                     ID = ConstString.BuzzerStartReadyTime,
                     Name = ConstString.BuzzerStartReadyTime,
-                    Value = "3000",
+                    Value = "500",
                     Desc = "BeforeMoveBuzzer",
                     EditTime = DateTime.Now
                 },
@@ -73,7 +73,7 @@ namespace OHV.SqliteDAL
                 {
                     ID = ConstString.PIOTimeOut,
                     Name= ConstString.PIOTimeOut,
-                    Value = "5000",
+                    Value = "10000",
                     Desc = "PIO Time Out",
                     EditTime = DateTime.Now,
                 },
@@ -97,7 +97,7 @@ namespace OHV.SqliteDAL
                 {
                     ID = ConstString.RouteFilePath,
                     Name= ConstString.RouteFilePath,
-                    Value = @"C:\OHV\mahaOHV\route_map\ohv_testmap7.json",
+                    Value = @"C:\OHV\mahaOHV\route_map\ohv_map1.json",
                     Desc = "Route File Path",
                     EditTime = DateTime.Now,
                 },

+ 81 - 48
Dev/OHV/OHV.Vehicle/Concept/D_MainWindow.xaml

@@ -31,66 +31,81 @@
                     <GradientStop Color="#FF004D55"/>
                 </LinearGradientBrush>
             </Grid.Background>
-            <TextBlock Text="{Binding SwVersion, FallbackValue=VCS.1.001}" Margin="10,0,0,0" Background="{x:Null}" FontSize="15" Foreground="Gray" VerticalAlignment="Top" HorizontalAlignment="Left"/>
-            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
-                <TextBlock Style="{StaticResource MaterialDesignHeadline3TextBlock}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="60" FontWeight="Bold">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="2*"/>
+                    <ColumnDefinition Width="1*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                
+                <TextBlock Text="{Binding SwVersion, FallbackValue=VCS.1.001}" Margin="10,0,0,0" Background="{x:Null}" FontSize="15" Foreground="Gray" VerticalAlignment="Top" HorizontalAlignment="Left"/>
+                <StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" >
+                    <TextBlock Style="{StaticResource MaterialDesignHeadline3TextBlock}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="60" FontWeight="Bold">
                 Vehicle Control System
-                </TextBlock>
-            </StackPanel>
+                    </TextBlock>
+                </StackPanel>
+
+                <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Right" Width="200" Margin="0,0,0,0" Height="70">
+                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
+                        <materialDesign:PackIcon Kind="Chip" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
+                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White">CPU</TextBlock>
+                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding CPU, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                    </StackPanel>
 
-            <StackPanel Orientation="Vertical" HorizontalAlignment="Right" Width="200" Margin="0,0,300,0" Height="70">
-                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
-                    <materialDesign:PackIcon Kind="Chip" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
-                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White">CPU</TextBlock>
-                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding CPU, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
+                        <materialDesign:PackIcon Kind="Memory" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
+                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" >Memory</TextBlock>
+                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding RAM, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                    </StackPanel>
                 </StackPanel>
 
-                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
-                    <materialDesign:PackIcon Kind="Memory" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
-                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" >Memory</TextBlock>
-                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding RAM, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                <StackPanel Grid.Column="2" Orientation="Vertical" HorizontalAlignment="Right" Width="100" Margin="0,0,270,0" Height="70">
+                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
+                        <materialDesign:PackIcon Kind="CarConnected" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="{c:Binding 'IsDriveConnected ? media:Brushes.LimeGreen : media:Brushes.Red'}"/>
+                        <TextBlock Margin="5,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White">Drive</TextBlock>
+                    </StackPanel>
                 </StackPanel>
-            </StackPanel>
 
-            <StackPanel Margin="0,0,50,0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Right">
-                <Button Margin="1" HorizontalAlignment="Left" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}">
-                    <StackPanel Orientation="Horizontal">
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetworkOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto" Foreground="Red"
+                <StackPanel Grid.Column="2" Margin="0,0,10,0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Right">
+                    <Button Margin="1" HorizontalAlignment="Left" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}">
+                        <StackPanel Orientation="Horizontal">
+                            <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetworkOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto" Foreground="Red"
                                                  Visibility="{c:Binding 'OcsState == OHVCommonShareds:eOcsState.DisConnect'}"/>
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetwork" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto" Foreground="LimeGreen"
+                            <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetwork" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto" Foreground="LimeGreen"
                                                  Visibility="{c:Binding 'OcsState == OHVCommonShareds:eOcsState.Connect'}"/>
-                        <TextBlock Margin="2" Text="OCS" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
-                    </StackPanel>
-                </Button>
+                            <TextBlock Margin="2" Text="OCS" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
+                        </StackPanel>
+                    </Button>
 
-                <Button Margin="1" HorizontalAlignment="Center" Height="40" BorderBrush="{DynamicResource PrimaryHueMidBrush}" BorderThickness="1" Background="{x:Null}"
+                    <Button Margin="1" HorizontalAlignment="Center" Height="40" BorderBrush="{DynamicResource PrimaryHueMidBrush}" BorderThickness="1" Background="{x:Null}"
                         HorizontalContentAlignment="Left" Command="{Binding BatteryPopup}">
                         <StackPanel Orientation="Horizontal" Margin="3,0,0,0">
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="AUto" Foreground="Red"
+                            <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="AUto" Foreground="Red"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.DisConnect'}"/>
 
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryCharging" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="Blue"
+                            <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryCharging" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="Blue"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.Charge'}"/>
 
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Battery" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="LimeGreen"
+                            <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Battery" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="LimeGreen"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.Connect'}"/>
-                        <TextBlock Margin="2" Text="{Binding BatteryConnect, FallbackValue=Battery - }" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
-                        <TextBlock Margin="2" Text="{Binding SOC, StringFormat={}{0}%, FallbackValue=0%}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
-                    </StackPanel>
-                </Button>
-            </StackPanel>
-
-            <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20,0,0,0">
-                <StackPanel Orientation="Horizontal">
-                    <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="FileDocumentBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White"/>
-                    <TextBlock TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0">ID : </TextBlock>
-                    <TextBlock Text="{Binding VehicleID, FallbackValue=OHV001}" TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0"/>
+                            <TextBlock Margin="2" Text="{Binding BatteryConnect, FallbackValue=Battery - }" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
+                            <TextBlock Margin="2" Text="{Binding SOC, StringFormat={}{0}%, FallbackValue=0%}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
+                        </StackPanel>
+                    </Button>
                 </StackPanel>
-                <StackPanel Orientation="Horizontal">
-                    <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Timetable" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White" Margin="1,0,0,0"/>                
-                    <TextBlock Text="{Binding DateTime, FallbackValue=2020-02-24 13:09:33, StringFormat=' \{0:yyyy-MM-dd HH:mm:ss\}'}" TextAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" Margin="6,0,0,0"/>
+
+                <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20,0,0,0">
+                    <StackPanel Orientation="Horizontal">
+                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="FileDocumentBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White"/>
+                        <TextBlock TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0">ID :</TextBlock>
+                        <TextBlock Text="{Binding VehicleID, FallbackValue=OHV001}" TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0"/>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Timetable" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White" Margin="1,0,0,0"/>
+                        <TextBlock Text="{Binding DateTime, FallbackValue=2020-02-24 13:09:33, StringFormat=' \{0:yyyy-MM-dd HH:mm:ss\}'}" TextAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" Margin="6,0,0,0"/>
+                    </StackPanel>
                 </StackPanel>
-            </StackPanel>
+            </Grid>
         </Grid>
 
         <Grid Grid.Row="1" Background="#455a64">
@@ -193,17 +208,35 @@
                         </Grid.RowDefinitions>
 
                         <Grid Grid.Row="0">
-                            <Border BorderBrush="{x:Null}" BorderThickness="2" Margin="5"/>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="*"/>
+                            </Grid.ColumnDefinitions>
+                            <Border BorderBrush="{x:Null}" BorderThickness="2" Margin="5" Grid.Column="1"/>
                             <!--<Border BorderBrush="#FF00FFD3" BorderThickness="2" Margin="5"/>-->
-                            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
-                                <TextBlock Text="Current Tag" FontSize="20" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0">
+                                <materialDesign:PackIcon Kind="QrcodeScan" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="50" Width="auto" Foreground="Orange"/>
+                                <TextBlock Margin="10" Text="MCR" FontSize="20" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="1">
+                                <materialDesign:PackIcon Kind="GpsFixed" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="50" Width="auto" Foreground="Orange"/>
+                                <TextBlock Margin="10" Text="Point" FontSize="20" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                 <!--<TextBlock Text="Tag" FontSize="20" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->
                             </StackPanel>
                         </Grid>
                         <Grid Grid.Row="1">
-                            <Border BorderBrush="{x:Null}" BorderThickness="2" Margin="5"/>
-                            <StackPanel VerticalAlignment="Top"  HorizontalAlignment="Center">
-                                <TextBlock Text="{Binding CurrentTag, FallbackValue=0.00}" FontSize="20" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="*"/>
+                            </Grid.ColumnDefinitions>
+                            <Border BorderBrush="{x:Null}" BorderThickness="2" Margin="5" />
+
+                            <StackPanel VerticalAlignment="Center"  HorizontalAlignment="Center" Grid.Column="0">
+                                <TextBlock Text="{Binding CurrentMCR, FallbackValue=0.00}" FontSize="25" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                            </StackPanel>
+
+                            <StackPanel VerticalAlignment="Center"  HorizontalAlignment="Center" Grid.Column="1">
+                                <TextBlock Text="{Binding CurrentTag, FallbackValue=0.00}" FontSize="25" Foreground="Orange" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                             </StackPanel>
                         </Grid>
                     </Grid>

+ 41 - 8
Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs

@@ -169,8 +169,8 @@ namespace OHV.Vehicle.Concept
             set { this.SetProperty( ref this.batteryState, value ); }
         }
 
-        int currentTag;
-        public int CurrentTag
+        string currentTag = "None";
+        public string CurrentTag
         {
             get { return this.currentTag; }
             set { this.SetProperty( ref this.currentTag, value ); }
@@ -184,6 +184,21 @@ namespace OHV.Vehicle.Concept
             set { SetProperty( ref this.isDryRun, value ); }
         }
 
+        private string currentMCR = "None";
+
+        public string CurrentMCR
+        {
+            get { return currentMCR; }
+            set { SetProperty(ref this.currentMCR , value); }
+        }
+
+        private bool isDriveConnected = false;
+
+        public bool IsDriveConnected
+        {
+            get { return isDriveConnected; }
+            set { SetProperty(ref this.isDriveConnected, value); }
+        }
 
         #endregion
 
@@ -293,6 +308,28 @@ namespace OHV.Vehicle.Concept
             this.IsDryRun = false;
         }
 
+        private void ZmqManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            var property = sender.GetType().GetProperty(e.PropertyName);
+            var newValue = property.GetValue(sender, null);
+
+            switch(e.PropertyName)
+            {
+                default:
+                    break;
+
+                case "CurrentMCR":
+                    this.CurrentMCR = CastTo<string>.From<object>(newValue);
+                    break;
+                case "CurrentPointNo":
+                    this.CurrentTag = CastTo<int>.From<object>(newValue).ToString();
+                    break;
+                case "IsReqConnected":
+                    this.IsDriveConnected = CastTo<bool>.From<object>(newValue);
+                    break;
+            }
+        }
+
         private void ExecuteBatteryPopup()
         {
             this.messageController.ShowPopupView( Common.Shareds.ePopupType.BatteryConfigView );
@@ -602,12 +639,6 @@ namespace OHV.Vehicle.Concept
                         }
                         break;
 
-                    case "CurrentTag":
-                        {
-                            this.CurrentTag = CastTo<int>.From<object>( args.Args );
-                        }
-                        break;
-
                     default:
                         break;
                 }
@@ -645,6 +676,8 @@ namespace OHV.Vehicle.Concept
             //};
             //msg.MoveDir = DriveControlEventArgs.eMoveDir.LEFT;
             //this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( msg );
+
+            this.VCSystem.ZmqManager.PropertyChanged += ZmqManager_PropertyChanged;
         }
 
         public void Dispose()

+ 2 - 0
Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs

@@ -473,6 +473,8 @@ namespace VehicleControlSystem.ControlLayer
             if ( result != EziMOTIONPlusELib.FMM_OK )
                 return 7;
 
+            LockUtils.Wait(500);
+
             result = RightOriginReturn();
             if ( result != EziMOTIONPlusELib.FMM_OK )
                 return 8;

+ 37 - 2
Dev/OHV/VehicleControlSystem/ControlLayer/MQ/ZmqManager.cs

@@ -73,7 +73,7 @@ namespace VehicleControlSystem.ControlLayer.MQ
         public bool IsReqConnected
         {
             get { return isReqConnected; }
-            set { isReqConnected = value; }
+            set { SetField(ref this.isReqConnected, value); }
         }
 
         #region Properties
@@ -171,7 +171,7 @@ namespace VehicleControlSystem.ControlLayer.MQ
             set { SetField( ref this.rearRPM, value ); }
         }
 
-        private string currentMCR;
+        private string currentMCR ="None";
         public string CurrentMCR
         {
             get { return currentMCR; }
@@ -313,6 +313,7 @@ namespace VehicleControlSystem.ControlLayer.MQ
             this.monitor = new NetMQMonitor( req, "inproc://rep.inproc", SocketEvents.Disconnected | SocketEvents.Connected );
             this.monitor.Connected += ( s, a ) =>
             {
+                this.IsReqConnected = true;
                 this.SynchronizedParmeter();
             };
 
@@ -869,6 +870,40 @@ namespace VehicleControlSystem.ControlLayer.MQ
             return ret;
         }
 
+        public List<Alarm> GetAlarmBits()
+        {
+            var rll = new List<Alarm>();
+
+            string warningList = "4094/0xff/0x00/0x00/0x01";
+
+            var v = warningList.Split('/');
+
+            var mb = new MemoryBuffer();
+            for (int i = 1; i < v.Length; i++)
+            {
+                var _2b = v[i].Replace("0x", "");
+                mb.Append(HexaUtils.StringToByte(_2b));
+            }
+
+            var bs = mb.ToBytes;
+            var bitA = new BitArray(bs);
+
+            for (int i = 0; i < bitA.Length - 1; i++)
+            {
+                if ( bitA[i])
+                {
+                    //Alarm List 
+                }
+                else
+                {
+
+                }
+            }
+
+
+            return rll;
+        }
+
         public eOperatationMode GetOperationMode()
         {
             var rll = GetRequest( "111" );

+ 45 - 24
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -819,20 +819,21 @@ namespace VehicleControlSystem.ControlLayer
 
         void ReqFaultReset( DriveControlEventArgs _args )
         {
-            var ll = this.refObjects.ZmqManager.SetDriveControl(eDriveControl.ResetFault);
-
-            if(ll == 38)
-            {
-                logger.E($"Servo Fault Reset Error");
-            }
-
             var msg = new DriveControlEventArgs
             {
                 ControlKind = DriveControlEventArgs.eControlKind.FaultReset
             };
-            msg.Result = Results.Ok("Drive Fault Reset");
 
-            msg.Result = Results.Ok( "Drive On" );
+            var ll = this.refObjects.ZmqManager.SetDriveControl(eDriveControl.ResetFault);
+
+            if (ll == 38)
+            {
+                logger.E($"Drive Fault Reset Error");
+                msg.Result = Results.Fail("Drive Fault Reset Error");
+            }
+            else
+                msg.Result = Results.Ok();
+            
             this.DriveControlEventPublish( msg );
         }
 
@@ -871,18 +872,20 @@ namespace VehicleControlSystem.ControlLayer
 
         void ReqDriveOn( DriveControlEventArgs _args )
         {
+            var msg = new DriveControlEventArgs
+            {
+                ControlKind = DriveControlEventArgs.eControlKind.DriveON
+            };
+
             var ll = this.refObjects.ZmqManager.SetDriveControl( eDriveControl.ServoOn );
 
             if(ll == 38)
             {
-                logger.E( $"Servo On Error" );
+                logger.E( $"Drive On Error" );
+                msg.Result = Results.Fail("Drive On Error");
             }
-
-            var msg = new DriveControlEventArgs
-            {
-                ControlKind = DriveControlEventArgs.eControlKind.DriveON
-            };
-            msg.Result = Results.Ok( "Drive On" );
+            else
+              msg.Result = Results.Ok( "Drive On" );
 
             this.DriveControlEventPublish( msg );
         }
@@ -1411,12 +1414,12 @@ namespace VehicleControlSystem.ControlLayer
 
             return 0;
 #else
+            PIOClear();
             this.PIOSensorOn();
             LockUtils.Wait( 500 );
 
             var pioTimeout = Convert.ToInt32( this.refObjects.Sqlite.ConfigDal.GetById( ConstString.PIOTimeOut ).Value );
 
-            PIOClear();
             loggerPIO.I( $"Start Battery Charge PIO" );
 
             if ( !this.refObjects.IO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_SENDABLE" ) )
@@ -1425,7 +1428,7 @@ namespace VehicleControlSystem.ControlLayer
                 loggerPIO.E( "[Port] - 4 Ready Time Out" );
                 return 34;
             }
-            loggerPIO.E( "[Port] - 4 Ready On" );
+            loggerPIO.I( "[Port] - 4 Ready On" );
 
             this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
             loggerPIO.I( "[Vehicle] - 4 Receivable" );
@@ -1438,6 +1441,18 @@ namespace VehicleControlSystem.ControlLayer
             }
             loggerPIO.I( "[Port] - 5 Sending Run On" );
 
+            //ToDo:Sensor Detect Wait...
+            long sTime = SwUtils.CurrentTimeMillis;
+            while (!IsChargeCylinderForword())
+            {
+                LockUtils.Wait(10);
+                if ( SwUtils.Gt(sTime, 5000))
+                {
+                    PIOClear();
+                    return 45; //Alarm ID 추가.
+                }
+            }
+
             this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVE_RUN", true );
             loggerPIO.I( "[Vehicle] - 5 Receive Run On" );
 
@@ -1497,6 +1512,18 @@ namespace VehicleControlSystem.ControlLayer
             }
             loggerPIO.I( "[Port] Send Complete On" );
 
+            //ToDo:Sensor Detect Wait...
+            long sTime = SwUtils.CurrentTimeMillis;
+            while (IsChargeCylinderForword())
+            {
+                LockUtils.Wait(10);
+                if (SwUtils.Gt(sTime, 5000))
+                {
+                    PIOClear();
+                    return 44; //Alarm ID 추가.
+                }
+            }
+
             Thread.Sleep( 1000 );
             this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", false );
 
@@ -2032,10 +2059,7 @@ namespace VehicleControlSystem.ControlLayer
 
             result = this.refObjects.Clamp.Lock_Sync();
             if ( result != 0 )
-            {
-                this.OccurVehicleAlarm( result );
                 return result;
-            }
 
             return result;
         }
@@ -2085,10 +2109,7 @@ namespace VehicleControlSystem.ControlLayer
 
             result = this.refObjects.Clamp.Unlock_Sync();
             if ( result != 0 )
-            {
-                this.OccurVehicleAlarm( result );
                 return result;
-            }
 
             this.refObjects.IO.WriteOutputIO( "OUT_PIO_SENDING_RUN", true );
             loggerPIO.I( "[Vehicle] - 2 Send Run On" );

+ 2 - 1
Dev/OHV/VehicleControlSystem/Managers/Scheduler.cs

@@ -84,7 +84,8 @@ namespace VehicleControlSystem.Managers
         {
             try
             {
-                cmd.TargetName = RouteManager.Instance.Equipments.Where( e => e.pointID.ToString().Equals( cmd.TargetID ) ).FirstOrDefault().Name;
+                var route = RouteManager.Instance.Equipments.Where(e => e.pointID.ToString().Equals(cmd.TargetID)).FirstOrDefault();
+                cmd.TargetName = route != null ? route.Name : "Not Eq";
                 this.sql.CommandDAL.Insert( cmd );
                 logger.I( $"[Command Added] - Target : {cmd.TargetID} / Type : {cmd.Type}" );
             }

+ 27 - 19
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -65,20 +65,6 @@ namespace VehicleControlSystem
 
         public void Init()
         {
-            //string warningList = "4094/0xff/0x00/0x00/0x01";
-
-            //var v = warningList.Split( '/' );
-
-            //var mb = new MemoryBuffer();
-            //for ( int i = 1; i < v.Length; i++ )
-            //{
-            //    var _2b = v[i].Replace( "0x", "" );
-            //    mb.Append( HexaUtils.StringToByte( _2b ) );
-            //}
-
-            //var bs = mb.ToBytes;
-
-            //var bitA = new BitArray( bs );
 
             QuartzUtils.Invoke("HIS_ALARM", QuartzUtils.GetExpnHour(5), this.CleanHisAlarm);
 
@@ -178,12 +164,14 @@ namespace VehicleControlSystem
         #region EzIO Event
         private void EzIO_OnChangedIO(BitBlock bit)
         {
-            this.eventAggregator.GetEvent<IOChangedPubSubEvent>().Publish(new IOChangedMessageEventArgs { Args = bit });
+            //this.eventAggregator.GetEvent<IOChangedPubSubEvent>().Publish(new IOChangedMessageEventArgs { Args = bit });
         }
+
         private void EzIO_OnDiscontd(string ID)
         {
             //throw new NotImplementedException();
         }
+
         private void EzIO_OnContd(string ID)
         {
             //IO 연결 시 할일 들을 여기서 하자.
@@ -192,6 +180,7 @@ namespace VehicleControlSystem
 
             //throw new NotImplementedException();
         }
+
         private void EzIO_OnFirstColtd(string ID)
         {
             if (this.IO.IsOff("IN_MC_ON"))
@@ -462,10 +451,19 @@ namespace VehicleControlSystem
                 result = this.vehicle.ManualPIOAndUnlaod();
 
             //실행 결과 확인 
-            if (result <= 0)
+            if (result == ConstInt.EXECUTE_SUCCESS)
                 reply.Result = FluentResults.Results.Ok();
             else
-                reply.Result = FluentResults.Results.Fail("PIO Fail");
+            {
+                string alarmText = string.Empty;
+                var alarm = this.Alarms.Where(a => a.AlarmId == result).FirstOrDefault();
+                if (alarm == null)
+                    alarmText = "Not Define";
+                else
+                    alarmText = alarm.Text;
+
+                reply.Result = FluentResults.Results.Fail(alarmText);
+            }
 
             GUIMessageEventPublish(reply);
         }
@@ -482,13 +480,23 @@ namespace VehicleControlSystem
 
             result = this.vehicle.StartBatteryCharge();
 
-            if (result <= 0)
+            if (result == ConstInt.EXECUTE_SUCCESS)
                 reply.Result = FluentResults.Results.Ok();
             else
-                reply.Result = FluentResults.Results.Fail("Battery Charge Start Fail");
+            {
+                string alarmText = string.Empty;
+                var alarm = this.Alarms.Where(a => a.AlarmId == result).FirstOrDefault();
+                if (alarm == null)
+                    alarmText = "Not Define";
+                else
+                    alarmText = alarm.Text;
+
+                reply.Result = FluentResults.Results.Fail(alarmText);
+            }
 
             GUIMessageEventPublish(reply);
         }
+
         private void ReqBatteryChargeStop(VCSMessageEventArgs msg)
         {
             int result = 1;

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

@@ -18,7 +18,7 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>TRACE;DEBUG;SIMULATION</DefineConstants>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>3</WarningLevel>
   </PropertyGroup>

+ 2 - 1
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/App.config

@@ -6,8 +6,9 @@
 
 	<appSettings>
 		<add key="VehicleID" value="V01"/>
-		<add key="FTPUploadIP" value="192.168.127.123"/>
+		<add key="FTPUploadIP" value="109.19.54.164"/>
 		<add key="PLC_IP" value="192.168.0.20"/>
 		<add key="PLC_PORT" value="5000"/>
+		<add key ="LOG_DIR" value="C:\LOG\OHV\DriveLogger\PhysicalCheckup"/>
 	</appSettings>
 </configuration>

+ 4 - 8
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FTPLogger.cs

@@ -1,10 +1,6 @@
 using FluentFTP;
 using GSG.NET.FileSystem;
 using GSG.NET.ObjectBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -17,19 +13,19 @@ namespace OHVDriveLogger
 
         private FTPLogger() { }
 
-        public void FTPUpload()
+        public void FTPUpload(string uploadPath)
         {
             using ( var ftp = new FtpClient( UploadIP ) )
             {
                 ftp.Connect();
-                //ftp.UploadDirectory( @"C:\LOG\FTP\", @"\LOG\", FtpFolderSyncMode.Update );
-                ftp.UploadDirectory( @"C:\LOG\OHV\DriveLogger\PhysicalCheckup\", @"\LOG\", FtpFolderSyncMode.Update);
+                ftp.UploadDirectory(@"C:\LOG\FTP\", uploadPath, FtpFolderSyncMode.Update);
+                ftp.UploadDirectory( @"C:\LOG\OHV\DriveLogger\PhysicalCheckup\", uploadPath, FtpFolderSyncMode.Update);
 
                 ftp.Disconnect();
                 ftp.Dispose();
             }
 
-            DeleteLocalFiles( @"C:\LOG\FTP\" );
+            DeleteLocalFiles( @"C:\LOG\FTP" );
         }
 
         public void FTPDriveLogUplaod()

+ 1 - 0
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FormMain.Designer.cs

@@ -71,6 +71,7 @@
             this.label55.TabIndex = 12;
             this.label55.Text = "PLC COMM";
             this.label55.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label55.Click += new System.EventHandler(this.label55_Click);
             // 
             // btnBit
             // 

+ 2 - 2
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger.csproj

@@ -17,7 +17,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>\\192.168.0.100\DriveLogger\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -43,7 +43,7 @@
     <Prefer32Bit>true</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RRmode|AnyCPU'">
-    <OutputPath>\\192.168.127.10\DriveLogger\</OutputPath>
+    <OutputPath>\\192.168.0.100\DriveLogger\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
     <DebugType>pdbonly</DebugType>

BIN
Documents/DirveInterface/mahaOHV_communication-v0.2.xlsx