diff --git a/AuroraDevices/AuroraPLC/Views/UCPLCBitViewModel.cs b/AuroraDevices/AuroraPLC/Views/UCPLCBitViewModel.cs index cb0e195..39aedc3 100644 --- a/AuroraDevices/AuroraPLC/Views/UCPLCBitViewModel.cs +++ b/AuroraDevices/AuroraPLC/Views/UCPLCBitViewModel.cs @@ -64,6 +64,8 @@ namespace AuroraPLC.Views public ICommand CMD_CalculateFlatness { get; } public ICommand CMD_ChangeValue { get; } + public static event Action OnPermissionChanged; + // 해당 뷰 enable 상태 /* private bool _isUCViewEnabled = true; @@ -309,6 +311,10 @@ namespace AuroraPLC.Views MonitorTimer = new DispatcherTimer(); MonitorTimer.Tick += OnMonitoring; MonitorTimer.Interval = TimeSpan.FromMilliseconds(250); + + + // CMY - 프로그램 실행 시 Recipe Lock + UpdateWriteState(); } private void UpdateLanguage(string lan) @@ -398,18 +404,8 @@ namespace AuroraPLC.Views private void UpdateWriteState() // 화면 내에서 사용자 권한이 변경되었을 경우 { - /* - var curPermissionLevel = ApplicationExt.PermissionLevel; - if (curPermissionLevel > (ushort)Aurora.Api.PermissionLevel.LEVEL3 || IsActivated == false) { // 권한 부족 - ChangeButtonEnable = false; - } else { - if (PLC.IsViewEnabled) { - ChangeButtonEnable = true; - } else { - ChangeButtonEnable = false; - } - } - */ + // CMY - 권한 설정이 변경 되었을 경우, Event 콜백 발생 + OnPermissionChanged?.Invoke(ApplicationExt.PermissionLevel); // Auto 모드인 경우, 변경 불가 if (PLCStatic.IsViewEnabled) { diff --git a/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs b/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs index 4ed0b99..f1b6cbc 100644 --- a/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs +++ b/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs @@ -57,7 +57,8 @@ namespace ILSOS_CCW_H52A public override string GetEquipmentName() { - return "ILSOS CCWH52A"; + var equipSetting = AuroraEnv.SettingEntry[AuroraSettings.Equipment] as EquipmentInfo; + return equipSetting is null ? "ILSOS CCWH52A" : equipSetting.EquipmentName; } public void OnSetAlarm(int code, bool isHeavy) diff --git a/Machines/ILSOS_CCW_H52A/Views/Main/UCMainAutoRunViewModel.cs b/Machines/ILSOS_CCW_H52A/Views/Main/UCMainAutoRunViewModel.cs index d5295b1..61d07d9 100644 --- a/Machines/ILSOS_CCW_H52A/Views/Main/UCMainAutoRunViewModel.cs +++ b/Machines/ILSOS_CCW_H52A/Views/Main/UCMainAutoRunViewModel.cs @@ -25,11 +25,10 @@ using System.Windows.Controls; using Aurora.Api.Manager; using System.Windows; using WeldingCommon.Recipes; +using AuroraPLC.Views; -namespace ILSOS_CCW_H52A.Views -{ - public class UCMainAutoRunViewModel : NotifyPropertyChangedBase - { +namespace ILSOS_CCW_H52A.Views { + public class UCMainAutoRunViewModel : NotifyPropertyChangedBase { private readonly Logger Log = new Logger("UCMainAutoRunViewModel"); public ICommand CMD_VisibleChanged { get; } @@ -79,6 +78,7 @@ namespace ILSOS_CCW_H52A.Views _SeqAutoRun = _Aurora.SequenceEntry[SequenceIds.SeqAutoRunCCWH52A]; _SeqAutoRun.RunStateChanged += AutoRunSeq_RunStateChanged; + UCPLCBitViewModel.OnPermissionChanged += Login_StateChanged; // CMY - Permission 이 변경되면 Recipe Lock Event (On/Off) InitVariable(); @@ -253,18 +253,33 @@ namespace ILSOS_CCW_H52A.Views return; } } + public void Login_StateChanged(ushort State) + { + bool LoginState = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3; + //LogOut 상황에서 Recipe Save Lock + _RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, true); + //LogOut 상황에서 Reicpe 화면 수정할 수 없도록 함 + Application.Current.Dispatcher.InvokeAsync(() => { _UCRecipe.IsEnabled = LoginState; }); + } + + private const bool LogOut = false; private void AutoRunSeq_RunStateChanged(object sender, (string sequenceId, SequenceRunState state) e) { + bool LoginState = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3; + //AutoRun 상황에서 Recipe Save Lock - _RecipeManager.SaveLock( - CommonRecipeIds.ScannerObjectTeaching, - e.state != SequenceRunState.Idle); + _RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, e.state != SequenceRunState.Idle); + //AutoRun 상황에서 Reicpe 화면 수정할 수 없도록 함 if (e.state == SequenceRunState.Running) { Application.Current.Dispatcher.InvokeAsync(() => { _UCRecipe.IsEnabled = false; }); + } else if (LoginState == LogOut) { + Application.Current.Dispatcher.InvokeAsync(() => { + _UCRecipe.IsEnabled = false; // CMY - 로그아웃 상태면 Auto가 풀려도 Recipe lock이 풀리지 않는다. + }); } else { Application.Current.Dispatcher.InvokeAsync(() => { _UCRecipe.IsEnabled = true; diff --git a/WeldingComponents/LASA/GUI/Dialog/WeldingParamDlg.cs b/WeldingComponents/LASA/GUI/Dialog/WeldingParamDlg.cs index fcd6aab..07c92e0 100644 --- a/WeldingComponents/LASA/GUI/Dialog/WeldingParamDlg.cs +++ b/WeldingComponents/LASA/GUI/Dialog/WeldingParamDlg.cs @@ -86,7 +86,7 @@ namespace CoreUnit.Scanner.UserControl.Canvas.Dialog btnOk.Enabled = false; btnCancel.Enabled = true; } - if(_MachineName == eMachineName.H52A_CCW || _MachineName == eMachineName.H52A_ACW || _MachineName == eMachineName.CIT) { + //if(_MachineName == eMachineName.H52A_CCW || _MachineName == eMachineName.H52A_ACW || _MachineName == eMachineName.CIT) { label58.Text = "(0~4000)"; label31.Text = "(0~4000)"; label32.Text = "(0~10000)"; @@ -182,7 +182,7 @@ namespace CoreUnit.Scanner.UserControl.Canvas.Dialog nudRampingEndPower2.Visible = false; #endregion - } + //} //Welding Paramter 색 지정 //rbParam1.ForeColor = Color.FromName(((WeldingParameterIDEditor.eWeldingColor)1).ToString());