浏览代码

현장 업데이트

ys-hwang 6 年之前
父节点
当前提交
69c47f10da

+ 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>
 

+ 44 - 31
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,19 @@ 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 ); }
         }
-            
 
-        eBatteryConnect batteryConnectState = eBatteryConnect.DisConnect;
-        public eBatteryConnect BatteryConnectState
+
+        eBatteryState batteryState = eBatteryState.DisConnect;
+        public eBatteryState BatteryState
         {
-            get { return this.batteryConnectState; }
-            set { this.SetProperty( ref this.batteryConnectState , value ); }
+            get { return this.batteryState; }
+            set { this.SetProperty( ref this.batteryState , value ); }
         }
 
         #endregion
@@ -434,12 +433,7 @@ namespace OHV.Vehicle.Concept
                 {
                     switch ( obj.ModelPropertyName )
                     {
-                        case "BatteryIsConnect":
-                            this.RspBatteryConnected( obj );
-                            break;
-                        case "BatteryStateOfCharge":
-                            this.SOC = CastTo<double>.From<object>( obj.Args );
-                            break;
+                        
                     }
                 }
             }
@@ -482,12 +476,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;
             }
         }
 
@@ -534,18 +528,37 @@ namespace OHV.Vehicle.Concept
 
             if (args.MessageKey.Equals(MessageKey.Vehicle))
             {
-                if (args.ModelPropertyName.Equals("VehicleStateProperty"))
-                {
-                    var vehicleState = CastTo<eVehicleState>.From<object>(args.Args);
-                    if (vehicleState == eVehicleState.Abnormal)
-                        this.IsVehicleAlarm = true;
-                    else
-                        this.IsVehicleAlarm = false;
-                }
-
-                if ( args.ModelPropertyName.Equals( "MachineMode" ) )
+                switch(args.ModelPropertyName)
                 {
-                    this.MachineMode = CastTo<eMachineMode>.From<object>( args.Args );
+                    case "VehicleStateProperty":
+                        {
+                            var vehicleState = CastTo<eVehicleState>.From<object>( args.Args );
+                            if ( vehicleState == eVehicleState.Abnormal )
+                                this.IsVehicleAlarm = true;
+                            else
+                                this.IsVehicleAlarm = false;
+                        }
+                        break;
+                    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 );
+                        }
+                        break;
                 }
             }
         }

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

@@ -1001,7 +1001,7 @@ namespace VehicleControlSystem.ControlLayer
             return true;
         }
 
-        private void BatteryCharge( SubCmd subCmd )
+        public void BatteryCharge( SubCmd subCmd )
         {
             this.VehicleStateProperty = eVehicleState.Charge;
 
@@ -1023,7 +1023,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();