[Common]
优化IAccountService的GetMenuPermission方法返回类型,由int变更为MenuPermissionEnum。 优化PermissionHelper的PaserPermission方法,移除字符串前后的\t字符。 优化RecipeData的BuildFormat方法,创建Recipe格式后立即设置权限。 [UI.Client] 修正PMProcess视图中的Recipe编辑表格中不显示行的问题。 移除RecipeEditorViewModel的UpdateRecipeFormat方法中设置Recipe行权限的代码,该权限已在RecipeDalta中设置。
This commit is contained in:
parent
265f70d63c
commit
97e1f2ab98
|
@ -11,6 +11,7 @@ using Aitex.Core.RT.Log;
|
|||
using Aitex.Core.Util;
|
||||
using MECF.Framework.Common.Account;
|
||||
using MECF.Framework.Common.Account.Extends;
|
||||
using MECF.Framework.Common.Account.Permissions;
|
||||
|
||||
namespace Aitex.Core.Account
|
||||
{
|
||||
|
@ -285,7 +286,7 @@ namespace Aitex.Core.Account
|
|||
return AccountExManager.Instance.RoleAccountLoader.GetAccessibleMenusByRole(roleId);
|
||||
}
|
||||
|
||||
public int GetMenuPermission(string roleId, string menuName)
|
||||
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
|
||||
{
|
||||
return AccountExManager.Instance.RoleAccountLoader.GetMenuPermission(roleId, menuName);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Aitex.Core.Account
|
|||
/// <param name="menuName">菜单名称</param>
|
||||
/// <returns></returns>
|
||||
[OperationContract]
|
||||
int GetMenuPermission(string roleId, string menuName);
|
||||
MenuPermissionEnum GetMenuPermission(string roleId, string menuName);
|
||||
|
||||
/// <summary>
|
||||
/// 保存所有角色的权限。
|
||||
|
|
|
@ -368,13 +368,13 @@ namespace MECF.Framework.Common.Account.Extends
|
|||
/// <param name="roleId"></param>
|
||||
/// <param name="menuName"></param>
|
||||
/// <returns></returns>
|
||||
public int GetMenuPermission(string roleId, string menuName)
|
||||
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
|
||||
{
|
||||
var rolePermission = GetRolePermission(roleId);
|
||||
if (rolePermission.TryGetValue(menuName, out var perm))
|
||||
return (int)perm;
|
||||
return perm;
|
||||
|
||||
return (int)MenuPermissionEnum.MP_NONE;
|
||||
return MenuPermissionEnum.MP_NONE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -38,7 +38,7 @@ public class PermissionHelper
|
|||
{
|
||||
try
|
||||
{
|
||||
permissionString = permissionString.Replace("\n", "").Trim(' ');
|
||||
permissionString = permissionString.Replace("\n", "").Trim(' ').Trim('\t');
|
||||
var groupIndex = permissionString.IndexOf(';');
|
||||
if (groupIndex == -1)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using Aitex.Core.Account;
|
|||
using Aitex.Core.Util;
|
||||
using Aitex.Core.WCF;
|
||||
using MECF.Framework.Common.Account.Extends;
|
||||
using MECF.Framework.Common.Account.Permissions;
|
||||
|
||||
namespace MECF.Framework.UI.Core.Accounts
|
||||
{
|
||||
|
@ -348,9 +349,9 @@ namespace MECF.Framework.UI.Core.Accounts
|
|||
return result;
|
||||
}
|
||||
|
||||
public int GetMenuPermission(string roleId, string menuName)
|
||||
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
|
||||
{
|
||||
var result = 0;
|
||||
var result = MenuPermissionEnum.MP_NONE;
|
||||
WCFProxy.Using(delegate(IAccountService svc)
|
||||
{
|
||||
result = svc.GetMenuPermission(roleId, menuName);
|
||||
|
|
|
@ -431,8 +431,9 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|||
// 如果RecipeData为空,则先创建其实例
|
||||
if (CurrentRecipe == null)
|
||||
{
|
||||
var role = AccountClient.Instance.Service.GetRoleByID(BaseApp.Instance.UserContext.Role.RoleId);
|
||||
var recipeData = new RecipeData(_recipeGasFlowCalculator, CurrentProcessType);
|
||||
recipeData.BuildFormat($"{CurrentChamberType}\\{CurrentProcessType}", SelectedChamber, BaseApp.Instance.UserContext.Role.RoleName);
|
||||
recipeData.BuildFormat($"{CurrentChamberType}\\{CurrentProcessType}", SelectedChamber, role);
|
||||
recipeData.OnValidated += (sender, args) =>
|
||||
{
|
||||
ErrorsCount = recipeData.ValidationErrorCount;
|
||||
|
@ -447,11 +448,6 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|||
|
||||
_editMode = EditMode.None;
|
||||
}
|
||||
|
||||
// 更新Permission
|
||||
var role = AccountClient.Instance.Service.GetRoleByName(BaseApp.Instance.UserContext.Role.RoleName);
|
||||
CurrentRecipe.UpdatePermission(role);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1923,7 +1923,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<dgExtension1:DataGridRecipe
|
||||
x:Name="dgCustom"
|
||||
x:Name="dgRecipeEditor"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
AllowDragToFill="False"
|
||||
|
|
|
@ -49,11 +49,11 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
private bool _allowRipRecipe = false;
|
||||
|
||||
private readonly IRecipeGasFlowCalculator _recipeGasFlowCalculator;
|
||||
private string _currectProcessingRecipe;
|
||||
private string _currentProcessingRecipe;
|
||||
private IProgress<int> _progressRecipeStepChanged;
|
||||
private IProgress<string> _progressLoadRecipe;
|
||||
private readonly object _lockerLoadingRecipe = new object();
|
||||
CancellationTokenSource cts = new CancellationTokenSource();
|
||||
private readonly object _lockerLoadingRecipe = new();
|
||||
CancellationTokenSource cts = new();
|
||||
|
||||
|
||||
public string title { get; set; } = "123";
|
||||
|
@ -130,12 +130,12 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
[Subscription("SelectedRecipeName")]
|
||||
public string CurrentProcessingRecipeName
|
||||
{
|
||||
get => _currectProcessingRecipe;
|
||||
get => _currentProcessingRecipe;
|
||||
set
|
||||
{
|
||||
if (_currectProcessingRecipe != value)
|
||||
if (_currentProcessingRecipe != value)
|
||||
{
|
||||
_currectProcessingRecipe = value;
|
||||
_currentProcessingRecipe = value;
|
||||
DisplayingRecipeName = value;
|
||||
}
|
||||
}
|
||||
|
@ -280,10 +280,10 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
|
||||
|
||||
//
|
||||
public RecipeData CurrentRecipe { get; set; } = new RecipeData(null, RecipeType.Process );
|
||||
public RecipeData CurrentRecipe { get; set; }
|
||||
public List<EditorDataGridTemplateColumnBase> Columns { get; set; } = new List<EditorDataGridTemplateColumnBase>();
|
||||
|
||||
private RecipeFormatBuilder _columnBuilder = new RecipeFormatBuilder();
|
||||
private RecipeFormatBuilder _recipeFormatBuilder = new ();
|
||||
|
||||
public bool IsSelectButtonEnable => !string.IsNullOrEmpty(Status) && !Status.Equals("Process")
|
||||
&& !Status.Equals("PreProcess") && !Status.Equals("PostProcess") && !Status.Equals("Paused")
|
||||
|
@ -409,20 +409,14 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
|
||||
//权限
|
||||
var roleID = BaseApp.Instance.UserContext.Role.RoleId;
|
||||
stepsVisibility = RoleAccountProvider.Instance.GetMenuPermission(roleID, "PM1.Process.Steps") == 3;
|
||||
StepsVisibility = RoleAccountProvider.Instance.GetMenuPermission(roleID, "PM1.Process.Steps") == MenuPermissionEnum.MP_READ_WRITE;
|
||||
_progressLoadRecipe = new Progress<string>(ProgLoadRecipeOnUiThread);
|
||||
_progressRecipeStepChanged = new Progress<int>(RecipeStepInProcessChanged);
|
||||
|
||||
UpdateRecipeFormat();
|
||||
}
|
||||
|
||||
|
||||
private bool stepsVisibility;
|
||||
|
||||
public bool StepsVisibility
|
||||
{
|
||||
get { return stepsVisibility; }
|
||||
}
|
||||
|
||||
public bool StepsVisibility { get; private set; }
|
||||
|
||||
protected override void Poll()
|
||||
{
|
||||
|
@ -660,8 +654,9 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
|
||||
public void UpdateRecipeFormat()
|
||||
{
|
||||
var role = AccountClient.Instance.Service.GetRoleByID(BaseApp.Instance.UserContext.Role.RoleId);
|
||||
CurrentRecipe = new RecipeData(_recipeGasFlowCalculator, RecipeType.Process);
|
||||
CurrentRecipe.BuildFormat($"Sic\\Process", SystemName, BaseApp.Instance.UserContext.Role.RoleName);
|
||||
CurrentRecipe.BuildFormat($"Sic\\Process", SystemName, role);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -761,7 +756,7 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
|
||||
|
||||
// 自动滚到当前做工艺的Step
|
||||
var dg = ((PMProcessView)View)?.dgCustom;
|
||||
var dg = ((PMProcessView)View)?.dgRecipeEditor;
|
||||
if (currentStepNum > 0)
|
||||
{
|
||||
var stepScrollTo = currentStepNum - 1;
|
||||
|
@ -833,8 +828,8 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
var recipeName = array[array.Length - 1];
|
||||
var prefixPath = selectedRecipePath.Replace(recipeName, "").TrimEnd('\\');
|
||||
|
||||
var _recipeProvider = new RecipeProvider();
|
||||
var recipeContent = _recipeProvider.ReadRecipeFile(prefixPath, recipeName);
|
||||
var recipeProvider = new RecipeProvider();
|
||||
var recipeContent = recipeProvider.ReadRecipeFile(prefixPath, recipeName);
|
||||
|
||||
if (string.IsNullOrEmpty(recipeContent))
|
||||
{
|
||||
|
@ -842,10 +837,10 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
return;
|
||||
}
|
||||
|
||||
CurrentRecipe.RecipeChamberType = _columnBuilder.RecipeChamberType;
|
||||
CurrentRecipe.RecipeVersion = _columnBuilder.RecipeVersion;
|
||||
CurrentRecipe.RecipeChamberType = _recipeFormatBuilder.RecipeChamberType;
|
||||
CurrentRecipe.RecipeVersion = _recipeFormatBuilder.RecipeVersion;
|
||||
|
||||
var role = BaseApp.Instance.UserContext.Role;
|
||||
var role = AccountClient.Instance.Service.GetRoleByID(BaseApp.Instance.UserContext.Role.RoleId);
|
||||
await CurrentRecipe.LoadFile(prefixPath, recipeName, recipeContent,
|
||||
SystemName, role, GetLoadingDispatcher());
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using MECF.Framework.Common.Account.Extends;
|
||||
using MECF.Framework.Common.Account.Permissions;
|
||||
using MECF.Framework.UI.Core.Accounts;
|
||||
using OpenSEMI.ClientBase.ServiceProvider;
|
||||
|
||||
|
@ -76,9 +77,9 @@ namespace MECF.Framework.UI.Client.ClientBase
|
|||
return AccountClient.Instance.Service.GetAccessibleMenusByRole(roleId);
|
||||
}
|
||||
|
||||
public int GetMenuPermission(string roleid, string menuName)
|
||||
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
|
||||
{
|
||||
return AccountClient.Instance.Service.GetMenuPermission(roleid, menuName);
|
||||
return AccountClient.Instance.Service.GetMenuPermission(roleId, menuName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -647,9 +647,10 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
|||
return false;
|
||||
}
|
||||
|
||||
public void BuildFormat(string path, string chamber, string roleName)
|
||||
public void BuildFormat(string path, string chamber, Role role)
|
||||
{
|
||||
Columns = _formatBuilder.Build(path, chamber, true, RecipeType);
|
||||
UpdatePermission(role);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
|
|
Loading…
Reference in New Issue