Browse Source

加入登录界面和权限管理

lixiang 1 year ago
parent
commit
0f905564d0

+ 1 - 0
Venus/Venus_Core/VenusMenu.cs

@@ -19,5 +19,6 @@ namespace Venus_Core
         [DataMember(Name = "IsShow")]
         public bool IsShow { get; set; }
 
+
     }
 }

+ 72 - 11
Venus/Venus_MainPages/Role/Menus.cs

@@ -1,14 +1,12 @@
-using System;
-using System.Collections.Generic;
+using Newtonsoft.Json.Converters;
+using Newtonsoft.Json;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Venus_Core;
+using System.Runtime.Serialization;
 
 namespace Venus_MainPages.Roles
 {
+    [DataContract]
     public class Menu : INotifyPropertyChanged
     {
         public Menu(string firstmenu, string secondmenu)
@@ -18,6 +16,7 @@ namespace Venus_MainPages.Roles
         }
 
         private string m_firstMenu;
+        [DataMember]
         public string FirstMenu
         {
             get { return m_firstMenu; }
@@ -29,7 +28,7 @@ namespace Venus_MainPages.Roles
         }
 
         private string m_SecondMenu;
-
+        [DataMember]
         public string SecondMenu
         {
             get { return m_SecondMenu; }
@@ -41,6 +40,8 @@ namespace Venus_MainPages.Roles
         }
 
         private MenuPermission m_Permission;
+        [DataMember]
+        [JsonConverter(typeof(StringEnumConverter))]
         public MenuPermission Permission
         {
             get { return m_Permission; }
@@ -51,6 +52,17 @@ namespace Venus_MainPages.Roles
             }
         }
 
+        private string m_View;
+        [DataMember]
+        public string View
+        {
+            get { return m_View; }
+            set
+            {
+                m_View = value;
+                OnPropertyChanged("View");
+            }
+        }
         #region INotifyPropertyChanged
         public event PropertyChangedEventHandler PropertyChanged;
 
@@ -75,13 +87,47 @@ namespace Venus_MainPages.Roles
         Technician,
         Operator
     }
-    public class RoleDefine
+    [DataContract]
+    public class RoleDefine : INotifyPropertyChanged
     {
-        public string RoleName { get; set; }
+        private string m_RoleName;
+        [DataMember]
+        public string RoleName
+        {
+            get { return m_RoleName; }
+            set
+            {
+                m_RoleName = value;
+                OnPropertyChanged("RoleName");
+            }
+        }
+        [DataMember]
 
-        public bool IsLocked { get; set; }
+        private bool m_IsLocked;
+
+        public bool IsLocked
+        {
+            get { return m_IsLocked; }
+            set
+            {
+                m_IsLocked = value;
+                OnPropertyChanged("IsLocked");
+            }
+        }
+        [DataMember]
+        private int m_LockTime;
+
+        public int LockTime
+        {
+            get { return m_LockTime; }
+            set
+            {
+                m_LockTime = value;
+                OnPropertyChanged("LockTime");
+            }
+        }
+        [DataMember]
 
-        public int LockTime { get; set; }
         public ObservableCollection<Menu> Menus { get; set; }
 
         public RoleDefine(string roleName, ObservableCollection<Menu> menus)
@@ -89,7 +135,16 @@ namespace Venus_MainPages.Roles
             RoleName = roleName;
             Menus = menus;
         }
+        #region INotifyPropertyChanged
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        private void OnPropertyChanged(string propertyName)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+        #endregion INotifyPropertyChanged
     }
+    [DataContract]
     public class User : INotifyPropertyChanged
     {
 
@@ -100,6 +155,8 @@ namespace Venus_MainPages.Roles
             Role = role;
         }
         private string m_Name;
+        [DataMember]
+
         public string Name
         {
             get { return m_Name; }
@@ -111,6 +168,8 @@ namespace Venus_MainPages.Roles
         }
 
         public string m_Password;
+        [DataMember]
+
         public string Password
         {
             get { return m_Password; }
@@ -121,6 +180,8 @@ namespace Venus_MainPages.Roles
             }
         }
         public Role m_Role;
+        [DataMember]
+        [JsonConverter(typeof(StringEnumConverter))]
         public Role Role
         {
             get { return m_Role; }

+ 0 - 15
Venus/Venus_MainPages/Role/Role.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Venus_Core;
-
-namespace Venus_MainPages.Role
-{
-    internal class Role
-    {
-        public string Name { get; set; }
-        public List<VenusMenu> Menus { get; set; }
-    }
-}

+ 0 - 15
Venus/Venus_MainPages/Role/User.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Venus_MainPages.Role
-{
-    internal class User
-    {
-        public int Id { get; set; }
-        public string Name { get; set; }
-        public string Menu {  get; set; }
-    }
-}

+ 0 - 2
Venus/Venus_MainPages/Venus_MainPages.csproj

@@ -139,8 +139,6 @@
     <Compile Include="PMS\UiRecipeManager.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Role\Menus.cs" />
-    <Compile Include="Role\Role.cs" />
-    <Compile Include="Role\User.cs" />
     <Compile Include="RTData.cs" />
     <Compile Include="Sequence\EventToCommand.cs" />
     <Compile Include="Sequence\FileNode.cs" />

+ 61 - 54
Venus/Venus_MainPages/ViewModels/RoleViewModel.cs

@@ -5,15 +5,15 @@ using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Controls;
-using System.Windows.Data;
 using Venus_Core;
 using Venus_Unity;
 using RoleDefine = Venus_MainPages.Roles.RoleDefine;
 using Menu = Venus_MainPages.Roles.Menu;
 using Venus_MainPages.Views;
+using Venus_MainPages.Roles;
+using System.Windows.Data;
+using WPF.Themes.UserControls;
+using System.IO;
 
 namespace Venus_MainPages.ViewModels
 {
@@ -21,13 +21,15 @@ namespace Venus_MainPages.ViewModels
     {
         #region 私有属性
         List<VenusMenu> m_venusMenus = new List<VenusMenu>();
-        ObservableCollection<Menu> m_Menus=new ObservableCollection<Menu>();
+        //ObservableCollection<Menu> m_Menus = new ObservableCollection<Menu>();
         ICollectionView vm;
         ObservableCollection<string> m_Roles = new ObservableCollection<string>();
 
         ObservableCollection<RoleDefine> m_RoleDefines = new ObservableCollection<RoleDefine>();
         private bool firstLoad = true;
         private RoleView roleView;
+
+        private RoleDefine m_CurrentRoleDefine;
         #endregion
 
         #region 依赖项属性
@@ -39,14 +41,14 @@ namespace Venus_MainPages.ViewModels
                 SetProperty(ref m_venusMenus, value);
             }
         }
-        public ObservableCollection<Menu> Menus
-        {
-            get { return m_Menus; }
-            set
-            {
-                SetProperty(ref m_Menus, value);
-            }
-        }
+        //public ObservableCollection<Menu> Menus
+        //{
+        //    get { return m_Menus; }
+        //    set
+        //    {
+        //        SetProperty(ref m_Menus, value);
+        //    }
+        //}
         public ObservableCollection<string> Roles 
         {
             get
@@ -66,65 +68,68 @@ namespace Venus_MainPages.ViewModels
                 SetProperty(ref m_RoleDefines, value);
             }
         }
+        public RoleDefine CurrentRoleDefine
+        {
+            get { return m_CurrentRoleDefine; }
+            set
+            {
+                SetProperty(ref m_CurrentRoleDefine, value);
+            }
+        }
         #endregion
 
+        #region 命令
         private DelegateCommand _SaveCommand;
         public DelegateCommand SaveCommand =>
             _SaveCommand ?? (_SaveCommand = new DelegateCommand(OnSave));
 
-        private DelegateCommand<object> _CheckedCommand;
-        public DelegateCommand<object> CheckedCommand =>
-            _CheckedCommand ?? (_CheckedCommand= new DelegateCommand<object>(OnChecked));
-
-
-        private DelegateCommand _SelectedItemChangedCommand;
-        public DelegateCommand SelectedItemChangedCommand =>
-            _SelectedItemChangedCommand ?? (_SelectedItemChangedCommand = new DelegateCommand(OnSelectedItemChanged));
-
         private DelegateCommand<Object> _LoadedCommand;
         public DelegateCommand<Object> LoadedCommand =>
             _LoadedCommand ?? (_LoadedCommand = new DelegateCommand<Object>(OnLoaded));
+        #endregion
+
+
 
         public RoleViewModel()
         {
-            VenusMenus = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>("Config/UIMenuList.json");
-
-            VenusMenus.ForEach(x =>
+            string configPath = "";
+            if (File.Exists($"Config/UIMenu.json"))
             {
-                x.MenuItem.ForEach(k =>
-                {
-                    Menus.Add(new Menu(x.Name, k.Id));
-                });
-            });
-
+                configPath = $"Config/UIMenu.json";
+            }
+            else if (File.Exists($"Config/Menu.json"))
+            {
+                configPath = $"Config/Menu.json";
+            }
+            else
+            {
+                //WPFMessageBox.ShowError("未发现UI Config配置文件,退出UI");
+            }
+            RoleDefines = SerializeHelper.Instance.ReadFromJsonFile<ObservableCollection<RoleDefine>>(configPath);
 
-            RoleDefines.Add(new RoleDefine("Manager", new ObservableCollection<Menu>(Menus)));
-            RoleDefines.Add(new RoleDefine("Engineer", new ObservableCollection<Menu>(Menus)));
-            RoleDefines.Add(new RoleDefine("Technician", new ObservableCollection<Menu>(Menus)));
-            RoleDefines.Add(new RoleDefine("Operator", new ObservableCollection<Menu>(Menus)));
+            for (int i = 0; i < RoleDefines.Count; i++)
+            {
+                Roles.Add(RoleDefines[i].RoleName);
+            } 
+            //Roles.Add("Manager");
+            //Roles.Add("Engineer");
+            //Roles.Add("Technician");
+            //Roles.Add("Operator");
 
-            Roles.Add("Manager");
-            Roles.Add("Engineer");
-            Roles.Add("Technician");
-            Roles.Add("Operator");
 
-            Menus = RoleDefines[0].Menus;
-            vm = CollectionViewSource.GetDefaultView(Menus);
-            vm.GroupDescriptions.Add(new PropertyGroupDescription("FirstMenu"));
         }
         private void OnSave()
         {
-            //SerializeHelper.Instance.WriteToJsonFile<List<VenusMenu>>(VenusMenus, "Config/UIMenu.json");
-        }
-
-        private void OnChecked(object obj)
-        { 
-        
+            //for (int i = 0; i < RoleDefines.Count; i++)
+            //{
+            //    for (int j = 0; j < RoleDefines[i].Menus.Count; j++)
+            //    {
+            //        RoleDefines[i].Menus[j].Permission = MenuPermission.ReadWrite;
+            //    } 
+            //}
+            SerializeHelper.Instance.WriteToJsonFile<List<RoleDefine>>(RoleDefines.ToList(), "Config/UIMenu.json");
         }
-        private void OnSelectedItemChanged()
-        {
 
-        }
         private void OnLoaded(Object myrecipeView)
         {
             if (firstLoad == true)
@@ -137,9 +142,11 @@ namespace Venus_MainPages.ViewModels
         private void RoleTreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
         {
             int index = Roles.IndexOf(e.NewValue.ToString());
-            Menus = RoleDefines[index].Menus;
-            //vm = CollectionViewSource.GetDefaultView(Menus);
-            //vm.GroupDescriptions.Add(new PropertyGroupDescription("FirstMenu"));
+            CurrentRoleDefine = RoleDefines[index];
+
+            vm = CollectionViewSource.GetDefaultView(CurrentRoleDefine.Menus);
+            vm.GroupDescriptions.Clear();
+            vm.GroupDescriptions.Add(new PropertyGroupDescription("FirstMenu"));
         }
     }
 }

+ 62 - 6
Venus/Venus_MainPages/Views/LoginView.xaml

@@ -9,7 +9,7 @@
              ResizeMode="NoResize"
              xmlns:userControl="clr-namespace:Venus_Themes.UserControls;assembly=Venus_Themes"
              xmlns:customControls="clr-namespace:Venus_Themes.CustomControls;assembly=Venus_Themes"
-             WindowStartupLocation="CenterScreen"
+             WindowStartupLocation="CenterScreen"           
              Width="1920" Height="1080">
     <Grid>
         <Image   Source="Pack://application:,,,/Venus_Themes;Component/Resources/Login.png" Stretch="Fill"/>
@@ -31,12 +31,68 @@
                 <TextBlock Grid.Row="1" Text="Login"                                       FontSize="42" FontFamily="D-DIN" Foreground="#222222" FontWeight="Bold"/>
                 <TextBlock Grid.Row="2" Text="Welcome back! Please login to your account." FontSize="16" FontFamily="D-DIN" Foreground="#999999"/>
                 <TextBlock Grid.Row="3" Text="UserName"                                    FontSize="16" FontFamily="D-DIN" Foreground="#666666"/>
-                <TextBox   Grid.Row="4" Height="30" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center" BorderThickness="0 0 0 1" FontSize="16"/>
+                <TextBox  x:Name="UserTextBox" Grid.Row="4" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 0 0 0" Foreground="Gray" Text="admin">
+                    <TextBox.Resources>
+                        <VisualBrush x:Key="WaterText" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Center" AlignmentY="Center">
+                            <VisualBrush.Visual>
+                                <TextBlock  Text="please enter your name"/>
+                            </VisualBrush.Visual>
+                        </VisualBrush>
+                        <Style TargetType="{x:Type Border}">
+                            <Setter Property="CornerRadius" Value="8"/>
+                            <Setter Property="BorderBrush" Value="#c1d0dc"/>
+                        </Style>
+
+                    </TextBox.Resources>
+                    <TextBox.Style>
+                     
+                        <Style TargetType="TextBox">
+                            <Style.Triggers>
+                                <Trigger Property="Text" Value="{x:Null}">
+                                    <Setter Property="Background" Value="{StaticResource WaterText}"/>
+                                </Trigger>
+                                <Trigger Property="Text" Value="">
+                                    <Setter Property="Background" Value="{StaticResource WaterText}"/>
+                                </Trigger>
+                            </Style.Triggers>
+                        </Style>
+                    </TextBox.Style>
+                </TextBox>
                 <TextBlock Grid.Row="5" Text="Password"                                    FontSize="16" FontFamily="D-DIN" Foreground="#666666"/>
-                <TextBox   Grid.Row="6" Height="30" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center" BorderThickness="0 0 0 1" FontSize="16"/>
+                <customControls:CustomPasswordBox  x:Name="PassWordTextBox" Grid.Row="6" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 5 0 0" Foreground="Gray">
+                    <customControls:CustomPasswordBox.Resources>
+                        <VisualBrush x:Key="WaterText" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Center" AlignmentY="Center">
+                            <VisualBrush.Visual>
+                                <TextBlock  Text="please enter your password"/>
+                            </VisualBrush.Visual>
+                        </VisualBrush>
+                        <Style TargetType="{x:Type Border}">
+                            <Setter Property="CornerRadius" Value="8"/>
+                            <Setter Property="BorderBrush" Value="#c1d0dc"/>
+                        </Style>
+                    </customControls:CustomPasswordBox.Resources>
+                    <customControls:CustomPasswordBox.Style>
+
+                        <Style TargetType="TextBox">
+                            <Style.Triggers>
+                                <Trigger Property="Text" Value="{x:Null}">
+                                    <Setter Property="Background" Value="{StaticResource WaterText}"/>
+                                </Trigger>
+                                <Trigger Property="Text" Value="">
+                                    <Setter Property="Background" Value="{StaticResource WaterText}"/>
+                                </Trigger>
+                            </Style.Triggers>
+                        </Style>
+                    </customControls:CustomPasswordBox.Style>
+                </customControls:CustomPasswordBox>
                 <TextBlock Grid.Row="7" Text="Role"                                    FontSize="16" FontFamily="D-DIN" Foreground="#666666"/>
-                <ComboBox  Grid.Row="8" Height="33" Width="400" HorizontalAlignment="Left" VerticalAlignment="Top"  Style="{StaticResource customeComboBoxStyle2}" Margin="0 -30 0 0"/>
-                <customControls:PathButton Grid.Row="9" Width="400" Height="40" Content="Login"          Command="{Binding LoginCommand}"   HorizontalAlignment="Left"    VerticalAlignment="Top"    />
+                <ComboBox x:Name="MangerComboBox" Grid.Row="8" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Top"  Style="{StaticResource customeComboBoxStyle2}" Margin="0 -30 0 0" SelectedIndex="0" FontSize="16">
+                    <ComboBoxItem>Manager</ComboBoxItem>
+                    <ComboBoxItem>Engineer</ComboBoxItem>
+                    <ComboBoxItem>Technician</ComboBoxItem>
+                    <ComboBoxItem>Operator</ComboBoxItem>
+                </ComboBox>
+                <customControls:PathButton Grid.Row="9" Width="400" Height="40" Content="Login"          Command="{Binding LoginCommand}"   HorizontalAlignment="Left"    VerticalAlignment="Top"   Click="Login_Click" />
 
             </Grid>
         </Border>
@@ -46,6 +102,6 @@
                                 Margin="1880 -1000 0 0" 
                                 DefaultFillBrush="White"
                                 MouseOverBrush="Yellow"
-                                IsPressedBrush="Blue" Command="{Binding CloseCommand}"/>
+                                IsPressedBrush="Blue" Click="Close_Click"/>
     </Grid>
 </Window>

+ 34 - 1
Venus/Venus_MainPages/Views/LoginView.xaml.cs

@@ -1,4 +1,8 @@
-using System;
+using Aitex.Core.Account;
+using MECF.Framework.UI.Core.Accounts;
+using Prism.Ioc;
+using Prism.Regions;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -12,6 +16,8 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using Venus_MainPages.Roles;
+using WPF.Themes.UserControls;
 
 namespace Venus_MainPages.Views
 {
@@ -20,9 +26,36 @@ namespace Venus_MainPages.Views
     /// </summary>
     public partial class LoginView : Window
     {
+
+        public bool IsLoginSuccess { get; set; }
+        public User CurrentUser { get; set; }
         public LoginView()
         {
             InitializeComponent();
         }
+
+        private void Close_Click(object sender, RoutedEventArgs e)
+        {
+            IsLoginSuccess = false;
+            this.Close();
+        }
+        private void Login_Click(object sender, RoutedEventArgs e)
+        {
+            IsLoginSuccess = true;
+            if (UserTextBox.Text != "admin")
+            {
+                IsLoginSuccess = false;
+                WPFMessageBox.ShowError("用户名错误");
+                return;
+            }
+            if (PassWordTextBox.Password != "admin")
+            {
+                IsLoginSuccess = false;
+                WPFMessageBox.ShowError("密码错误");
+                return;
+            }
+            CurrentUser = new User(UserTextBox.Text, PassWordTextBox.Password, (Role)Enum.Parse(typeof(Role), (MangerComboBox.SelectedItem as ComboBoxItem).Content.ToString(), true));
+            this.Close();
+        }
     }
 }

+ 5 - 10
Venus/Venus_MainPages/Views/RoleView.xaml

@@ -10,34 +10,29 @@
              xmlns:unity="clr-namespace:Venus_MainPages.Unity"
              prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800" Name="roleView">
+             d:DesignHeight="1000" d:DesignWidth="1920" x:Name="roleView">
     <i:Interaction.Triggers>
         <i:EventTrigger EventName="Loaded">
             <i:InvokeCommandAction Command="{Binding LoadedCommand}" CommandParameter="{Binding ElementName=roleView}"/>
         </i:EventTrigger>
     </i:Interaction.Triggers>
     <Canvas>
-        <TreeView ItemsSource="{Binding Roles}" Canvas.Left="10" x:Name="roleTreeView">
-            <i:Interaction.Triggers>
-                <i:EventTrigger EventName="SelectedItemChanged">
-                    <i:InvokeCommandAction Command="{Binding SelectedItemChangedCommand}"/>
-                </i:EventTrigger>
-            </i:Interaction.Triggers>
+        <TreeView ItemsSource="{Binding Roles}" Canvas.Left="10" Name="roleTreeView">
         </TreeView>
 
         <StackPanel Orientation="Horizontal" Canvas.Left="150" Canvas.Top="30">
             <TextBlock Text="IsLock" FontSize="20"/>
-            <CheckBox  Canvas.Left="200" Canvas.Top="10" Margin="4"/>
+            <CheckBox  Canvas.Left="200" Canvas.Top="10" Margin="4" IsChecked="{Binding CurrentRoleDefine.IsLocked}"/>
         </StackPanel>
 
         <StackPanel Orientation="Horizontal" Canvas.Left="150" Canvas.Top="70">
             <TextBlock Text="LockTime:" FontSize="20"/>
-            <TextBox Width="100" FontSize="20" BorderThickness="0,0,0,1" BorderBrush="Black" Background="Transparent"/>
+            <TextBox Width="100" FontSize="20" BorderThickness="0,0,0,1" BorderBrush="Black" Background="Transparent" HorizontalContentAlignment="Center" Text="{Binding CurrentRoleDefine.LockTime}"/>
             <TextBlock Text="(s)" FontSize="20"/>
         </StackPanel>
 
         <customControls:PathButton Content="Save" Width="120" Height="33" Canvas.Left="400" Canvas.Top="66" Command="{Binding SaveCommand}"/>
-        <DataGrid   ItemsSource="{Binding Menus}" AlternationCount="2"
+        <DataGrid   ItemsSource="{Binding CurrentRoleDefine.Menus}" AlternationCount="2"
                     SelectionUnit="Cell"
                     FontSize="20"
                     Height="700"

+ 1 - 1
Venus/Venus_RT/App.config

@@ -28,7 +28,7 @@
 	<connectionStrings>
 		<add name="PostgreSQL"   connectionString="Server=localhost;Port=5432;User Id=postgres;Password=123456;Database=postgres;Enlist=true;Preload Reader=true;" />
 		<!--0是other,1是Venus,2是kepler2300,3是Kepler2200,4是VenusSE,5是VenusDE-->
-		<add name="ConfigType"   connectionString="2"/>
+		<add name="ConfigType"   connectionString="3"/>
 	</connectionStrings>
 	<system.serviceModel>
 		<!--<diagnostics>

+ 2 - 2
Venus/Venus_RT/Devices/AdTecRF.cs

@@ -425,7 +425,7 @@ namespace Venus_RT.Devices
             _trigOnOff.CLK = _bRFPowerOn;
             if (_trigOnOff.R)   //RF Turn On
             {
-                _timerRFTurnOn.Start(SC.GetValue<int>($"{Module}.Rf.RFTurnOnTimeout") * 1000);
+                _timerRFTurnOn.Start(SC.GetValue<int>($"{Module}.{Name}.RFTurnOnTimeout") * 1000);
             }
             if (_trigOnOff.M)   //RF Stay On
             {
@@ -433,7 +433,7 @@ namespace Venus_RT.Devices
                 {
                     if (!IsPowerOn)
                     {
-                        LOG.Write(eEvent.ERR_RF, Module, "RF Turn On Failed");
+                        LOG.Write(eEvent.ERR_RF, Module, $"{Name} Turn On Failed");
                         _timerRFTurnOn.Stop();
                     }
                 }

+ 16 - 13
Venus/Venus_RT/Devices/JetKepler2300PM.cs

@@ -118,7 +118,7 @@ namespace Venus_RT.Devices
         private float _chillerOuterTemp => GetAiValue($"{Module}.AI_ESC_outer_coolant_outlet_TC_Temp");
         private float _chillerTopTemp => GetAiValue($"{Module}.AI_Top_Plate_coolant_outlet_TC_Temp");
 
-        
+        private Stopwatch _pendulumValveStopWatch = new Stopwatch();
 
         // 盖子的状态
         public override bool IsLidClosed => _Lid.OFFFeedback;
@@ -176,7 +176,7 @@ namespace Venus_RT.Devices
             {
                 if (ProcessPressure < 100)
                 {
-                    return  ProcessPressure;
+                    return ProcessPressure;
                 }
                 else
                 {
@@ -202,7 +202,7 @@ namespace Venus_RT.Devices
 
         public override bool ChillerIsRunning => false;
 
-        public bool innerChillerIsRunning=>_InnerChiller.IsRunning;
+        public bool innerChillerIsRunning => _InnerChiller.IsRunning;
         public bool outerChillerIsRunning => _OuterChiller.IsRunning;
         public bool topChillerIsRunning => _TopChiller.IsRunning;
 
@@ -309,7 +309,7 @@ namespace Venus_RT.Devices
         #region 构造函数
         public JetKepler2300PM(ModuleName moduleName) : base(moduleName)
         {
-             Module = moduleName;
+            Module = moduleName;
             _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");
             _LidLoadlock = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.LidLoadlock}");
 
@@ -490,7 +490,7 @@ namespace Venus_RT.Devices
             _GasRFStopWatch.Stop();
             DATA.Subscribe($"{Module}.ChillerInnerTemp", () => _chillerInnerTemp);
             DATA.Subscribe($"{Module}.ChillerOuterTemp", () => _chillerOuterTemp);
-            DATA.Subscribe($"{Module}.ChillerTopTemp",   () => _chillerTopTemp);
+            DATA.Subscribe($"{Module}.ChillerTopTemp", () => _chillerTopTemp);
 
             //DATA.Subscribe($"{Module}.InnerChiller.IsRunning", () => innerChillerIsRunning);
             //DATA.Subscribe($"{Module}.OuterChiller.IsRunning", () => outerChillerIsRunning);
@@ -506,7 +506,7 @@ namespace Venus_RT.Devices
             //    OnOffChiller(ChillerType.InnerChiller, (bool)(args[1]));
             //    return true;
             //});
-
+            _pendulumValveStopWatch.Start();
         }
 
         #endregion
@@ -672,14 +672,17 @@ namespace Venus_RT.Devices
             {
                 gas.Monitor();
             }
-
-            CheckPermanentInterlock();
+            if (_pendulumValveStopWatch.ElapsedMilliseconds > 2000)
+            {
+                CheckPermanentInterlock();
+                _pendulumValveStopWatch.Restart();
+            }
         }
 
 
         protected override void CheckPermanentInterlock()
         {
-            if (ProcessPressure>=100 && _GuageValve.SetPoint)
+            if (ProcessPressure >= 99 && _GuageValve.SetPoint)
             {
                 _GuageValve.TurnValve(false, out _);
                 LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 99 mtorr, Guage Valve (DO-31) closed automaticlly.");
@@ -777,7 +780,7 @@ namespace Venus_RT.Devices
                 }
                 else
                 {
-                    
+
                     double maxPressureDifference = SC.GetValue<double>("System.PMTMMaxPressureDifference");
                     if (Math.Abs(TMPressure - ChamberPressure) > maxPressureDifference)
                     {
@@ -884,7 +887,7 @@ namespace Venus_RT.Devices
                     await Task.Delay(1000);
                     _TopChiller?.SetChillerOnOff(true);
                     break;
-            }         
+            }
         }
 
         public override void OnOffChiller(ChillerType chillerType, bool onoff)
@@ -1212,7 +1215,7 @@ namespace Venus_RT.Devices
         }
         public override bool RFInterlock(VenusDevice device)
         {
-            eEvent evt =  eEvent.ERR_RF;
+            eEvent evt = eEvent.ERR_RF;
 
             if (!IsWaterFlowOk)
             {
@@ -1260,6 +1263,6 @@ namespace Venus_RT.Devices
             }
             return false;
         }
-        
+
     }
 }

+ 0 - 1
Venus/Venus_RT/Devices/PendulumValve.cs

@@ -312,7 +312,6 @@ namespace Venus_RT.Devices
                                 if ((m_JetChamber == JetChamber.Kepler2200A || m_JetChamber == JetChamber.Kepler2200B))
                                 {
                                     Pressure =Convert.ToSingle( ConvertPressureUnit.ConvertPaTomtorr( pressure * _pressure_ful_range / 1000000));
-                                    //Pressure = pressure * _pressure_ful_range / 1000000;
                                 }
 								else if(m_JetChamber == JetChamber.VenusSE || m_JetChamber == JetChamber.VenusDE)
                                 {

+ 11 - 8
Venus/Venus_RT/Devices/VirgoSignalTower.cs

@@ -5,6 +5,8 @@ using System;
 using System.Collections.Generic;
 using Aitex.Core.RT.Log;
 using Venus_RT.Devices.EFEM;
+using Venus_RT.Modules;
+
 namespace Venus_RT.Devices
 {
     class VenusSignalLight : SignalLightBase
@@ -18,10 +20,11 @@ namespace Venus_RT.Devices
 
         private TowerLightStatus _preState = TowerLightStatus.Unknown;
         IoSignalTower _SignalTower;
-        public VenusSignalLight(string module, string name) : base(module, name)
+        public VenusSignalLight(string module, string name, EfemBase _efem) : base(module, name)
         {
             _isInit = true;
             _SignalTower= Aitex.Core.RT.Device.DEVICE.GetDevice<IoSignalTower>($"PMA.SignalTower");
+            EfemController = _efem;
         }
 
         protected override void SetOn()
@@ -94,7 +97,7 @@ namespace Venus_RT.Devices
 
                     break;
             }
-            EfemController?.SetLamp(venusType, venusSetpoint);
+            //EfemController?.SetLamp(venusType, venusSetpoint);
             _SignalTower?.SetLight(venusType, lightState);
             return true;
         }
@@ -139,7 +142,7 @@ namespace Venus_RT.Devices
 
     public class VenusSignalTower : SignalTowerBase
     {
-        //private Efem _efem;
+        private EfemBase _efem;
 
         private List<VenusSignalLight> _lights = new List<VenusSignalLight>();
 
@@ -154,10 +157,10 @@ namespace Venus_RT.Devices
         {
             base.Initialize();
 
-            //if (_efem == null)
-            //{
-            //    _efem = Singleton<RouteManager>.Instance.EFEM.EfemDevice;
-            //}
+            if (_efem == null && Singleton<RouteManager>.Instance.EFEM!=null)
+            {
+                _efem = Singleton<RouteManager>.Instance.EFEM.EfemDevice;
+            }
 
             CustomSignalTower();
 
@@ -175,7 +178,7 @@ namespace Venus_RT.Devices
 
         public override SignalLightBase CreateLight(MECF.Framework.Common.Device.Bases.LightType type)
         {
-            var light = new VenusSignalLight(ModuleName.System.ToString(), $"SignalLight{type}")
+            var light = new VenusSignalLight(ModuleName.System.ToString(), $"SignalLight{type}", _efem)
             { Type = type};
             _lights.Add(light);
             return light;

+ 145 - 0
Venus/Venus_Themes/CustomControls/CustomPasswordBox.cs

@@ -0,0 +1,145 @@
+using System;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+
+namespace Venus_Themes.CustomControls
+{
+    public class CustomPasswordBox:TextBox
+    {
+        #region Variables
+
+        #region Data
+
+        #endregion
+
+        public String Password
+        {
+            get { return (String)GetValue(PwdTextProperty); }
+            set
+            {
+                SetValue(PwdTextProperty, value);
+            }
+        }
+        /// <summary>
+        ///     The DependencyProperty for the ItemsSource property.
+        ///     Flags:              None
+        ///     Default Value:      null
+        /// </summary>
+        public static readonly DependencyProperty PwdTextProperty
+            = DependencyProperty.Register("PwdText", typeof(string), typeof(PasswordBox),
+                                          new FrameworkPropertyMetadata("",
+                                                                        new PropertyChangedCallback(OnPwdTextChanged)));
+
+        private static void OnPwdTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            PasswordBox ic = (PasswordBox)d;
+            string oldValue = e.OldValue as string;
+            string newValue = e.NewValue as string;
+        }
+
+
+        public String PasswordChar
+        {
+            get { return (String)GetValue(PwdCharProperty); }
+            set
+            {
+                SetValue(PwdTextProperty, value);
+            }
+        }
+        /// <summary>
+        ///     The DependencyProperty for the ItemsSource property.
+        ///     Flags:              None
+        ///     Default Value:      null
+        /// </summary>
+        public static readonly DependencyProperty PwdCharProperty
+            = DependencyProperty.Register("PasswordChar", typeof(String), typeof(PasswordBox),
+                                          new FrameworkPropertyMetadata("*",
+                                                                        new PropertyChangedCallback(OnPwdCharChanged)));
+
+        private static void OnPwdCharChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+        }
+
+
+        private string SetPwdString(string value)
+        {
+            try
+            {
+                var str = value + "";
+                var list = str.ToArray();
+                var dst = "";
+                var pwd = "*";
+                if (PasswordChar != null)
+                {
+                    pwd = PasswordChar + "";
+                }
+                foreach (var item in list)
+                {
+                    dst += pwd;
+                }
+                return dst;
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return null;
+        }
+
+
+        #endregion
+
+        #region static Variables
+        #endregion
+
+        #region Methods
+        #region 构造函数
+       
+
+        protected override void OnTextInput(System.Windows.Input.TextCompositionEventArgs e)
+        {
+            base.OnTextInput(e);
+        }
+        bool ChangeToPwd = false;
+        protected override void OnTextChanged(TextChangedEventArgs e)
+        {
+            var str = SetPwdString(Text);
+            if (ChangeToPwd)
+            {
+                return;
+            }
+            ChangeToPwd = true;
+            int offset = 0;
+            foreach (var item in e.Changes)
+            {
+                offset = item.Offset;
+                if (item.RemovedLength > 0)
+                {
+                    Password = Password.Remove(item.Offset, item.RemovedLength);
+                }
+                if (item.AddedLength > 0)
+                {
+                    var insertStr = Text.Substring(item.Offset, item.AddedLength);
+                    Password = Password.Insert(item.Offset, insertStr);
+                    offset = item.Offset + item.AddedLength;
+                }
+            }
+            Text = str;
+            this.Select(offset, 0);
+            base.OnTextChanged(e);
+            ChangeToPwd = false;
+        }
+
+        #endregion
+
+        #endregion
+
+        #region static Methods
+        #endregion
+
+        #region Event
+        #endregion
+    }
+}

+ 31 - 0
Venus/Venus_Themes/CustomControls/TextBoxMasked.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public  class TextBoxWithMark : TextBox
+    {
+        public static readonly DependencyProperty WaterMarksProperty = DependencyProperty.Register(
+            "WaterMarks", typeof(string), typeof(TextBoxWithMark), new PropertyMetadata(default(string)));
+
+        public string WaterMarks
+        {
+            get
+            {
+                return (string)GetValue(WaterMarksProperty);
+            }
+            set
+            {
+                SetValue(WaterMarksProperty, value);
+            }
+        }
+
+    }
+}
+

+ 0 - 2
Venus/Venus_Themes/Themes/Generic.xaml

@@ -2392,6 +2392,4 @@ Header,RelativeSource={RelativeSource TemplatedParent}}" />
         <Setter Property="Template" Value="{StaticResource RingProgress_Template}" />
         <Setter Property="Background" Value="#D2D2D2" />
     </Style>
-
-
 </ResourceDictionary>

+ 2 - 0
Venus/Venus_Themes/Venus_Themes.csproj

@@ -111,6 +111,7 @@
     <Compile Include="CustomControls\Controls\WindowButtonMin.cs" />
     <Compile Include="CustomControls\Controls\WindowButtonNormal.cs" />
     <Compile Include="CustomControls\Controls\WindowTopArea.cs" />
+    <Compile Include="CustomControls\CustomPasswordBox.cs" />
     <Compile Include="CustomControls\GuangChuanRobot.cs" />
     <Compile Include="CustomControls\CustomRobot.cs" />
     <Compile Include="CustomControls\MultiComboBox.cs" />
@@ -121,6 +122,7 @@
     <Compile Include="CustomControls\SplitButton.cs" />
     <Compile Include="CustomControls\StepBar.cs" />
     <Compile Include="CustomControls\StepBarItem.cs" />
+    <Compile Include="CustomControls\TextBoxMasked.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Themes\Attach\BorderElement.cs" />
     <Compile Include="Themes\Attach\ElementBackground.cs" />

+ 17 - 7
Venus/Venus_UI/App.xaml.cs

@@ -2,10 +2,12 @@
 using Aitex.Core.Util;
 using Prism.Ioc;
 using Prism.Modularity;
+using Prism.Services.Dialogs;
 using Prism.Unity;
 using System;
 using System.Threading;
 using System.Windows;
+using Venus_MainPages.Roles;
 using Venus_MainPages.Views;
 using Venus_UI.Views;
 using WPF.Themes.UserControls;
@@ -18,7 +20,7 @@ namespace Venus_UI
     public partial class App : PrismApplication
     {
         System.Threading.Mutex mutex;
-
+        public static User CurrentUser;
         protected override void OnStartup(StartupEventArgs e)
         {
             bool ret;
@@ -29,14 +31,21 @@ namespace Venus_UI
                 WPFMessageBox.ShowError("Only One Venus_UI is allowed");
                 Environment.Exit(0);
             }
-
-
-            //LoginView loginView = new LoginView();
-            //loginView.ShowDialog();
             FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
-
             DispatcherUnhandledException += App_DispatcherUnhandledException;
             Singleton<LogManager>.Instance.Initialize();
+
+
+            ShellView shellView = new ShellView();
+
+            LoginView loginView = new LoginView();
+            loginView.ShowDialog();
+            CurrentUser = loginView.CurrentUser;
+            if (!loginView.IsLoginSuccess)
+            {
+                Current.Shutdown();
+                return;
+            }
             base.OnStartup(e);
 
         }
@@ -47,7 +56,7 @@ namespace Venus_UI
         }
         protected override Window CreateShell()
         {
-            return Container.Resolve<ShellView>();                      
+            return Container.Resolve<ShellView>();
         }
         protected override void RegisterTypes(IContainerRegistry containerRegistry)
         {
@@ -57,5 +66,6 @@ namespace Venus_UI
         {
             return new ConfigurationModuleCatalog();
         }
+
     }
 }

File diff suppressed because it is too large
+ 1182 - 0
Venus/Venus_UI/Config/Menu.json


+ 0 - 367
Venus/Venus_UI/Config/UIMenu.json

@@ -1,367 +0,0 @@
-[
-
-  {
-    "Id": "Operation",
-    "Name": "Operation",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "OperationOverView",
-        "IsShow": "true",
-        "Name": "OverView",
-        "View": "OperationOverView"
-      },
-      {
-        "Id": "Platform",
-        "IsShow": "false",
-        "Name": "Platform",
-        "View": "PlatformView"
-      },
-      {
-        "Id": "Sequence",
-        "IsShow": "true",
-        "Name": "Sequence",
-        "View": "SequenceView"
-      },
-      {
-        "Id": "Fa",
-        "IsShow": "true",
-        "Name": "FA",
-        "View": "FAView"
-      }
-    ]
-  },
-  {
-    "Id": "PMA",
-    "Name": "PMA",
-
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "View": "OverView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "View": "RecipeView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "GasLeakCheck",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "MFCVerification",
-        "Name": "MFC Calibration",
-        "View": "MFCVerificationView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "PartialPressure",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMB",
-    "Name": "PMB",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "View": "OverView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "View": "RecipeView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "GasLeakCheck",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "MFCVerification",
-        "Name": "MFC Calibration",
-        "View": "MFCVerificationView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "PartialPressure",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMC",
-    "Name": "PMC",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "IsShow": "true",
-        "View": "OverView"
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "IsShow": "true",
-        "View": "RecipeView"
-      },
-      {
-        "Id": "GasLeakCheck",
-        "IsShow": "true",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView"
-      },
-      {
-        "Id": "MFCVerification",
-        "IsShow": "true",
-        "Name": "MFC Calibration",
-        "View": "MFCVerificationView"
-      },
-      {
-        "Id": "PartialPressure",
-        "IsShow": "true",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMD",
-    "Name": "PMD",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "IsShow": "true",
-        "Name": "Operation",
-        "View": "OverView"
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "IsShow": "true",
-        "Name": "Recipe",
-        "View": "RecipeView"
-      },
-      {
-        "Id": "GasLeakCheck",
-        "IsShow": "true",
-
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView"
-      },
-      {
-        "Id": "MFCVerification",
-        "IsShow": "true",
-        "Name": "MFC Calibration",
-        "View": "MFCVerificationView"
-      },
-      {
-        "Id": "PartialPressure",
-        "IsShow": "true",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "TM",
-    "Name": "Transfer",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Efem",
-        "IsShow": "true",
-        "Name": "EFEM",
-        "View": "EfemView"
-      },
-      {
-        "Id": "TMOperation",
-        "IsShow": "true",
-        "Name": "TM Operation",
-        "View": "TMOperationView"
-      },
-      {
-        "Id": "TMTransfer",
-        "IsShow": "true",
-        "Name": "TM Transfer",
-        "View": "TMView"
-      },
-      {
-        "Id": "IO",
-        "Name": "TM IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "WaferOffset",
-        "IsShow": "true",
-        "Name": "Wafer Offset",
-        "View": "WaferOffsetView"
-      }
-    ]
-
-  },
-  {
-    "Id": "Configuration",
-    "Name": "Configuration",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "SystemConfig",
-        "IsShow": "true",
-        "Name": "SystemConfig",
-        "View": "SystemConfigView"
-      },
-      {
-        "Id": "Role",
-        "IsShow": "true",
-        "Name": "Role",
-        "View": "RoleView"
-      },
-      {
-        "Id": "SignalTowerConfig",
-        "IsShow": "true",
-        "Name": "SignalTower Config",
-        "View": "SignalTowerConfigView"
-      }
-    ]
-  },
-  {
-    "Id": "DataLog",
-    "Name": "DataLog",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Event",
-        "IsShow": "true",
-        "Name": "Event",
-        "View": "EventView"
-      },
-      {
-        "Id": "WaferHistoryDB",
-        "IsShow": "true",
-        "Name": "WaferHistory",
-        "View": "WaferHistoryDBView"
-      },
-      {
-        "Id": "ProcessHistory",
-        "IsShow": "true",
-        "Name": "Process History",
-        "View": "ProcessHistoryView"
-      },
-      {
-        "Id": "DataHistory",
-        "IsShow": "true",
-        "Name": "Data History",
-        "View": "DataHistoryView"
-      }
-    ]
-  }
-
-]

+ 0 - 373
Venus/Venus_UI/Config/UIMenuList.json

@@ -1,373 +0,0 @@
-[
-
-  {
-    "Id": "Operation",
-    "Name": "Operation",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "OperationOverView",
-        "IsShow": "true",
-        "Name": "OverView",
-        "View": "OperationOverView"
-      },
-      {
-        "Id": "Platform",
-        "IsShow": "false",
-        "Name": "Platform",
-        "View": "PlatformView"
-      },
-      {
-        "Id": "Sequence",
-        "IsShow": "true",
-        "Name": "Sequence",
-        "View": "SequenceView"
-      },
-      {
-        "Id": "Fa",
-        "IsShow": "true",
-        "Name": "FA",
-        "View": "FAView"
-      }
-    ]
-  },
-  {
-    "Id": "PMA",
-    "Name": "PMA",
-
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "View": "OverView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "View": "RecipeView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "GasLeakCheck",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "MFCVerification",
-        "Name": "MFCVerification",
-        "View": "MFCVerificationView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "PartialPressure",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMB",
-    "Name": "PMB",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "View": "OverView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "View": "RecipeView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "GasLeakCheck",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "MFCVerification",
-        "Name": "MFCVerification",
-        "View": "MFCVerificationView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "PartialPressure",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView",
-        "IsShow": "true"
-
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMC",
-    "Name": "PMC",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "Name": "Operation",
-        "IsShow": "true",
-        "View": "OverView"
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "Name": "Recipe",
-        "IsShow": "true",
-        "View": "RecipeView"
-      },
-      {
-        "Id": "GasLeakCheck",
-        "IsShow": "true",
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView"
-      },
-      {
-        "Id": "MFCVerification",
-        "IsShow": "true",
-        "Name": "MFCVerification",
-        "View": "MFCVerificationView"
-      },
-      {
-        "Id": "PartialPressure",
-        "IsShow": "true",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "PMD",
-    "Name": "PMD",
-    "IsShow": "true",
-
-    "MenuItem": [
-      {
-        "Id": "Operation",
-        "IsShow": "true",
-        "Name": "Operation",
-        "View": "OverView"
-      },
-      {
-        "Id": "IO",
-        "Name": "IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "Recipe",
-        "IsShow": "true",
-        "Name": "Recipe",
-        "View": "RecipeView"
-      },
-      {
-        "Id": "GasLeakCheck",
-        "IsShow": "true",
-
-        "Name": "Gas&Leak Check",
-        "View": "GasLeakCheckView"
-      },
-      {
-        "Id": "MFCVerification",
-        "IsShow": "true",
-        "Name": "MFCVerification",
-        "View": "MFCVerificationView"
-      },
-      {
-        "Id": "PartialPressure",
-        "IsShow": "true",
-        "Name": "Partial Pressure",
-        "View": "PartialPressureView"
-      },
-      {
-        "Id": "VATPerformance",
-        "Name": "VAT Performance",
-        "View": "VATPerformanceView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "RFCalibration",
-        "Name": "RF Calibration",
-        "View": "RFCalibrationView",
-        "IsShow": "true"
-      }
-
-    ]
-  },
-  {
-    "Id": "TM",
-    "Name": "Transfer",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Efem",
-        "IsShow": "true",
-        "Name": "EFEM",
-        "View": "EfemView"
-      },
-      {
-        "Id": "TMOperation",
-        "IsShow": "true",
-        "Name": "TM Operation",
-        "View": "TMOperationView"
-      },
-      {
-        "Id": "TMTransfer",
-        "IsShow": "true",
-        "Name": "TM Transfer",
-        "View": "TMView"
-      },
-      {
-        "Id": "IO",
-        "Name": "TM IO",
-        "View": "IOView",
-        "IsShow": "true"
-      },
-      {
-        "Id": "WaferOffset",
-        "IsShow": "true",
-        "Name": "Wafer Offset",
-        "View": "WaferOffsetView"
-      }
-    ]
-
-  },
-  {
-    "Id": "Configuration",
-    "Name": "Configuration",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "SystemConfig",
-        "IsShow": "true",
-        "Name": "SystemConfig",
-        "View": "SystemConfigView"
-      },
-      {
-        "Id": "Role",
-        "IsShow": "true",
-        "Name": "Role",
-        "View": "RoleView"
-      },
-      {
-        "Id": "User",
-        "IsShow": "true",
-        "Name": "User",
-        "View": "UserView"
-      },
-      {
-        "Id": "SignalTowerConfig",
-        "IsShow": "true",
-        "Name": "SignalTower Config",
-        "View": "SignalTowerConfigView"
-      }
-    ]
-  },
-  {
-    "Id": "DataLog",
-    "Name": "DataLog",
-    "IsShow": "true",
-    "MenuItem": [
-      {
-        "Id": "Event",
-        "IsShow": "true",
-        "Name": "Event",
-        "View": "EventView"
-      },
-      {
-        "Id": "WaferHistoryDB",
-        "IsShow": "true",
-        "Name": "WaferHistory",
-        "View": "WaferHistoryDBView"
-      },
-      {
-        "Id": "ProcessHistory",
-        "IsShow": "true",
-        "Name": "Process History",
-        "View": "ProcessHistoryView"
-      },
-      {
-        "Id": "DataHistory",
-        "IsShow": "true",
-        "Name": "Data History",
-        "View": "DataHistoryView"
-      }
-    ]
-  }
-
-]

+ 1 - 4
Venus/Venus_UI/Venus_UI.csproj

@@ -160,10 +160,7 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
-    <Content Include="Config\UIMenu.json">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Config\UIMenuList.json">
+    <Content Include="Config\Menu.json">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
     <None Include="Properties\Settings.settings">

+ 99 - 66
Venus/Venus_UI/Views/ShellView.xaml.cs

@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.Windows;
 using Venus_Themes.CustomControls;
-using Venus_UI.Themes.Attach;
 using Venus_Unity;
 using System.Linq;
 using System;
@@ -21,15 +20,10 @@ using Venus_Themes.Unity;
 using MECF.Framework.Common.Equipment;
 using WinInterop = System.Windows.Interop;
 using System.Runtime.InteropServices;
-using Aitex.Core.RT.SCCore;
-using Venus_Themes.UserControls;
 using System.IO;
 using System.Windows.Media.Imaging;
-using System.Threading.Tasks;
-using Aitex.Core.UI.View.Frame;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.CodeDom;
-using System.Windows.Media.Animation;
+using Venus_MainPages.Roles;
+using WPF.Themes.UserControls;
 
 namespace Venus_UI.Views
 {
@@ -40,7 +34,8 @@ namespace Venus_UI.Views
     {
         IRegionManager m_regionManager;
         IRegionNavigationService m_regionNavigationService;
-        List<VenusMenu> VenusMenu;
+        //List<VenusMenu> VenusMenu;
+        List<RoleDefine> RoleDefines;
         public List<TabControl> centerTabViews = new List<TabControl>();
         public List<AduRadioButtonIcon> buttonList = new List<AduRadioButtonIcon>();
         DispatcherTimer timer = new DispatcherTimer();
@@ -198,83 +193,121 @@ namespace Venus_UI.Views
             //this.ResizeMode = ResizeMode.CanResize;
             //System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth
 
-            VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
-            int index = 0;
-            for (int i = 0; i < VenusMenu.Count; i++)
+            //VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
+            //App.currentUser
+            string configPath = "";
+            if (File.Exists($"Config/UIMenu.json"))
             {
-                if (VenusMenu[i].IsShow == false)
+                configPath = $"Config/UIMenu.json";
+            }
+            else if (File.Exists($"Config/Menu.json"))
+            {
+                configPath = $"Config/Menu.json";
+            }
+            else
+            {
+                WPFMessageBox.ShowError("未发现UI Config配置文件,退出UI");
+                this.Close();
+            }
+            RoleDefines = SerializeHelper.Instance.ReadFromJsonFile<List<RoleDefine>>(configPath);
+            string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
+            //TabControl tabControl = new TabControl();
+            int role = (int)App.CurrentUser.Role;
+            var menu = RoleDefines[role].Menus;
+            List<string> modules = new List<string>();
+            for (int i = 0; i < menu.Count; i++)
+            {
+                if (!modules.Contains(menu[i].FirstMenu))
+                {
+                    modules.Add(menu[i].FirstMenu);
+                    centerTabViews.Add(new TabControl());
+                }
+            }
+
+
+            int index = -1;
+            string lastModule="";
+            
+            for (int i = 0; i < menu.Count; i++)
+            {
+                if (menu[i].Permission == MenuPermission.None)
                 {
                     continue;
                 }
-                string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
-                if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
+                if (menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD" || menu[i].FirstMenu == "TM")
                 {
-                    if (!allModules.Contains(VenusMenu[i].Id))
+                    if (!allModules.Contains(menu[i].FirstMenu))
                     {
                         continue;
                     }
                 }
 
-                //if (VenusMenu[i].Id == "SETM" && SC.GetStringValue("System.ChamberSelect") !="4" && SC.GetStringValue("System.ChamberSelect") != "5")
-                //{
-                //    //不是SE DE
-                //    continue;
-                //}
 
-                AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
-                Button button = new Button();
-                if (i == 0)
+                string className;
+                if ((menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD") && menu[i].SecondMenu=="Operation")
                 {
-                    aduRadioButtonIcon.IsChecked = true;
+                    JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{menu[i].FirstMenu}.ChamberType")));
+                    className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
                 }
-                IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
-                aduRadioButtonIcon.Content = VenusMenu[i].Name;
-                aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
-                aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
-                aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
-                //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
-                //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
-
-
-                aduRadioButtonIcon.Width = 180;
-                //aduRadioButtonIcon.Height = 40;
-
-                //aduRadioButtonIcon.Foreground=Brushes.White;
-                aduRadioButtonIcon.Tag = index;
-                buttonList.Add(aduRadioButtonIcon);
-                index += 1;
-                Bottom_Frame.Children.Add(aduRadioButtonIcon);
-
-                TabControl tabControl = new TabControl();
-                for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
+                else
                 {
-                    if (VenusMenu[i].MenuItem[j].IsShow == false)
-                    {
-                        continue;
-                    }
-                    string className;
-                    if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD") && VenusMenu[i].MenuItem[j].Id == "Operation")
-                    {
-                        JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
-                        className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
-                    }
-                    else
-                    {
-                        className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
-                    }
+                    className = $"Venus_MainPages.Views.{menu[i].View}";
+                }
 
-                    Type t = Type.GetType($"{className},Venus_MainPages");
-                    var obj = System.Activator.CreateInstance(t);
+                Type t = Type.GetType($"{className},Venus_MainPages");
+                var obj = System.Activator.CreateInstance(t);
 
 
-                    if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM" || VenusMenu[i].Id == "SETM")
+                if (menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD" || menu[i].FirstMenu == "TM" || menu[i].FirstMenu == "SETM")
+                {
+                    MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
+                    methodInfo?.Invoke(obj, new object[] { menu[i].FirstMenu });
+                }
+                if (lastModule != menu[i].FirstMenu)
+                {
+                    AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
+                    index += 1;
+                    if (index == 0)
                     {
-                        MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
-                        methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
+                        aduRadioButtonIcon.IsChecked = true;
                     }
-                    tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
+                    //IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{menu[i].se}"));
+                    aduRadioButtonIcon.Content = menu[i].FirstMenu;
+                    aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
+                    aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
+                    aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
+                    //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
+                    //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
+
+
+                    aduRadioButtonIcon.Width = 180;
+                    //aduRadioButtonIcon.Height = 40;
+
+                    //aduRadioButtonIcon.Foreground=Brushes.White;
+                    aduRadioButtonIcon.Tag = index;
+                    buttonList.Add(aduRadioButtonIcon);
+
+                    Bottom_Frame.Children.Add(aduRadioButtonIcon);
                 }
-                centerTabViews.Add(tabControl);
+                TabItem tabItem = new TabItem() { Header = menu[i].SecondMenu, Content = obj };
+                if (menu[i].Permission == MenuPermission.ReadOnly)
+                {
+                    (tabItem.Content as Control).IsEnabled = false;
+                }
+                centerTabViews[index].Items.Add(tabItem);
+                lastModule = menu[i].FirstMenu;
+                //tabControl.Items.Add(new TabItem() { Header = menu[i].SecondMenu, Content = obj });
+
+
+                //for (int j = 0; j < menu.Count; j++)
+                //{
+                //    if (menu[j].Permission == MenuPermission.None)
+                //    {
+                //        continue;
+                //    }
+
+                //}
+                //centerTabViews.Add(tabControl);
             }
             Main_Frame.Content = centerTabViews[0];
             ModuleManager.Initialize();