Selaa lähdekoodia

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

# Conflicts:
#	Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs
SK.Kang 6 vuotta sitten
vanhempi
commit
ca851fd282

+ 0 - 11
Dev/OHV/OHV.Common/Shareds/SharedEnumType.cs

@@ -96,17 +96,6 @@
 		WaitStop,
 	}
 
-	public enum eBatteryConnect
-	{
-		DisConnect,
-		Connect
-	}
-	public enum eBatteryCharge
-	{
-		DisCharge,
-		Charge
-	}
-
 	public enum eOcsState
 	{
 		DisConnect,

+ 17 - 22
Dev/OHV/OHV.Vehicle/Concept/D_MainWindow.xaml

@@ -53,43 +53,38 @@
                         <TextBlock Text="{Binding SOC, StringFormat={}{0}%, FallbackValue=0%}"/>
                     </StackPanel>
                 </Button>-->
-                
+
                 <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"
+                        <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'}"/>
-                        <TextBlock Margin="2" Text="OCS ::" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
-                        <TextBlock Margin="2" Text="{Binding OcsState, FallbackValue=X}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
-
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetwork" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto"
+                        <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> 
+                </Button>
 
                 <Button Margin="1" HorizontalAlignment="Center" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}"
                         HorizontalContentAlignment="Left">
                     <StackPanel Orientation="Horizontal">
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="40" Width="AUto"
-                                                 Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.DisConnect'}"/>
-                        <TextBlock Margin="2" Text="{Binding BatteryConnect, FallbackValue=Battery ::}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"
-                                   Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.DisConnect'}"/>
-                        <TextBlock Margin="2" Text="{Binding SOC, StringFormat={}{0}%, FallbackValue=0%}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"
-                                   Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.DisConnect'}"/>
-
-                        <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryCharging" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="40" Width="auto"
-                                                 Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.Connect'}"/>
-                        <TextBlock Margin="2" Text="{Binding BatteryConnect, FallbackValue=Battery ::}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"
-                                   Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.Connect'}"/>
-                        <TextBlock Margin="2" Text="{Binding SOC, StringFormat={}{0}%, FallbackValue=0%}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"
-                                   Visibility="{c:Binding 'BatteryConnectState == OHVCommonShareds:eBatteryConnect.Connect'}"/>
+                        <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"
+                                                 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"
+                                                 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">
-                <TextBlock Text="{Binding VehicleID, FallbackValue=VehicleControlSystem 1.0.0.1}" VerticalAlignment="Center" Foreground="LightGray" FontSize="20" Margin="0,0,0,10"/>
-                <TextBlock Text="{Binding DateTime, FallbackValue=2020-02-24 13:09:33, StringFormat=' \{0:yyyy-MM-dd HH:mm:ss\}'}" VerticalAlignment="Center" FontSize="20" Foreground="LightGray"/>
+                <TextBlock Text="{Binding VehicleID, FallbackValue=VehicleControlSystem 1.0.0.1}" TextAlignment="Left" VerticalAlignment="Center" Foreground="LightGray" FontSize="20" Margin="0,0,0,5"/>
+                <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="LightGray"/>
             </StackPanel>
         </Grid>
 

+ 59 - 11
Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs

@@ -27,6 +27,12 @@ using VehicleControlSystem;
 
 namespace OHV.Vehicle.Concept
 {
+    public enum eBatteryState
+    {
+        DisConnect,
+        Connect,
+        Charge,
+    }
     class D_MainWindowViewModel : BindableBase
     {
         #region Properties
@@ -149,26 +155,28 @@ namespace OHV.Vehicle.Concept
             set { SetProperty( ref this.machineMode, value ); }
         }
 
-        //HostConnectedEventArgs.eConnectedState ocsState = HostConnectedEventArgs.eConnectedState.Disconnected;
-        //public HostConnectedEventArgs.eConnectedState OcsState
-        //{
-        //    get { return this.ocsState; }
-        //    set { this.SetProperty( ref this.ocsState , value ); }
-        //}
-
         eOcsState ocsState = eOcsState.DisConnect;
         public eOcsState OcsState
         {
             get { return this.ocsState; }
             set { this.SetProperty( ref this.ocsState, value ); }
         }
+<<<<<<< HEAD
 
+=======
+>>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
 
-        eBatteryConnect batteryConnectState = eBatteryConnect.DisConnect;
-        public eBatteryConnect BatteryConnectState
+
+        eBatteryState batteryState = eBatteryState.DisConnect;
+        public eBatteryState BatteryState
         {
+<<<<<<< HEAD
             get { return this.batteryConnectState; }
             set { this.SetProperty( ref this.batteryConnectState, value ); }
+=======
+            get { return this.batteryState; }
+            set { this.SetProperty( ref this.batteryState , value ); }
+>>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
         }
 
         #endregion
@@ -428,6 +436,20 @@ namespace OHV.Vehicle.Concept
 
         private void UICallbackCommunication( GUIMessageEventArgs obj )
         {
+<<<<<<< HEAD
+=======
+            if ( obj.Kind == GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange )
+            {
+                if ( obj.MessageKey.Equals( MessageKey.Vehicle ) )
+                {
+                    switch ( obj.ModelPropertyName )
+                    {
+                        
+                    }
+                }
+            }
+
+>>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
             switch ( obj.Kind )
             {
                 case GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange:
@@ -466,12 +488,12 @@ namespace OHV.Vehicle.Concept
             if ( connected )
             {
                 this.BatteryBrush = Brushes.LimeGreen;
-                BatteryConnectState = eBatteryConnect.Connect;
+                BatteryState = eBatteryState.Connect;
             }
             else
             {
                 this.BatteryBrush = Brushes.Gray;
-                BatteryConnectState = eBatteryConnect.DisConnect;
+                BatteryState = eBatteryState.DisConnect;
             }
         }
 
@@ -518,7 +540,11 @@ namespace OHV.Vehicle.Concept
 
             if ( args.MessageKey.Equals( MessageKey.Vehicle ) )
             {
+<<<<<<< HEAD
                 switch ( args.ModelPropertyName )
+=======
+                switch(args.ModelPropertyName)
+>>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
                 {
                     case "VehicleStateProperty":
                         {
@@ -529,6 +555,7 @@ namespace OHV.Vehicle.Concept
                                 this.IsVehicleAlarm = false;
                         }
                         break;
+<<<<<<< HEAD
 
                     case "MachineMode":
                         this.MachineMode = CastTo<eMachineMode>.From<object>( args.Args );
@@ -543,6 +570,27 @@ namespace OHV.Vehicle.Concept
                         break;
 
                     default:
+=======
+                    case "MachineMode":
+                        this.MachineMode = CastTo<eMachineMode>.From<object>( args.Args );
+                        break;
+                    case "BatteryIsConnect":
+                        this.RspBatteryConnected( args );
+                        break;
+                    case "BatteryStateOfCharge":
+                        this.SOC = CastTo<double>.From<object>( args.Args );
+                        break;
+                    case "BatteryChargeTime":
+                        {
+                            var cTime = CastTo<double>.From<object>( args.Args );
+                            this.BatteryState = eBatteryState.Charge;
+                        }
+                        break;
+                    case "BatteryDisChargeTime":
+                        {
+                            var cTime = CastTo<double>.From<object>( args.Args );
+                        }
+>>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
                         break;
                 }
             }

+ 2 - 2
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -989,7 +989,7 @@ namespace VehicleControlSystem.ControlLayer
             return true;
         }
 
-        private void BatteryCharge( SubCmd subCmd )
+        public void BatteryCharge( SubCmd subCmd )
         {
             this.VehicleStateProperty = eVehicleState.Charge;
 
@@ -1011,7 +1011,7 @@ namespace VehicleControlSystem.ControlLayer
         /// </summary>
         /// <param name="sub"></param>
         /// <returns></returns>
-        public int PIOBatteryCharge( SubCmd sub )
+        int PIOBatteryCharge( SubCmd sub )
         {
             var route = sql.RouteDal.GetRoute( sub.TargetID );
 

+ 2 - 1
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -260,7 +260,8 @@ namespace VehicleControlSystem
             var subCmd = this.sql.SubCmdDAL.GetSubCmd();
             subCmd.Type = eSubCommandType.Charge;
 
-            result = this.vehicle.PIOBatteryCharge( subCmd );
+            //result = this.vehicle.PIOBatteryCharge( subCmd );
+            this.vehicle.BatteryCharge( subCmd );
 
             if ( result <= 0 )
                 reply.Result = FluentResults.Results.Ok();