Recipe Lock (권한에 따라) + Get Equipment Name은 Parameter에서

This commit is contained in:
최민영 2026-03-16 18:51:17 +09:00
parent d19560b504
commit b900a276fe
4 changed files with 34 additions and 22 deletions

View File

@ -64,6 +64,8 @@ namespace AuroraPLC.Views
public ICommand CMD_CalculateFlatness { get; } public ICommand CMD_CalculateFlatness { get; }
public ICommand CMD_ChangeValue { get; } public ICommand CMD_ChangeValue { get; }
public static event Action<ushort> OnPermissionChanged;
// 해당 뷰 enable 상태 // 해당 뷰 enable 상태
/* /*
private bool _isUCViewEnabled = true; private bool _isUCViewEnabled = true;
@ -309,6 +311,10 @@ namespace AuroraPLC.Views
MonitorTimer = new DispatcherTimer(); MonitorTimer = new DispatcherTimer();
MonitorTimer.Tick += OnMonitoring; MonitorTimer.Tick += OnMonitoring;
MonitorTimer.Interval = TimeSpan.FromMilliseconds(250); MonitorTimer.Interval = TimeSpan.FromMilliseconds(250);
// CMY - 프로그램 실행 시 Recipe Lock
UpdateWriteState();
} }
private void UpdateLanguage(string lan) private void UpdateLanguage(string lan)
@ -398,18 +404,8 @@ namespace AuroraPLC.Views
private void UpdateWriteState() // 화면 내에서 사용자 권한이 변경되었을 경우 private void UpdateWriteState() // 화면 내에서 사용자 권한이 변경되었을 경우
{ {
/* // CMY - 권한 설정이 변경 되었을 경우, Event 콜백 발생
var curPermissionLevel = ApplicationExt.PermissionLevel; OnPermissionChanged?.Invoke(ApplicationExt.PermissionLevel);
if (curPermissionLevel > (ushort)Aurora.Api.PermissionLevel.LEVEL3 || IsActivated == false) { // 권한 부족
ChangeButtonEnable = false;
} else {
if (PLC.IsViewEnabled) {
ChangeButtonEnable = true;
} else {
ChangeButtonEnable = false;
}
}
*/
// Auto 모드인 경우, 변경 불가 // Auto 모드인 경우, 변경 불가
if (PLCStatic.IsViewEnabled) { if (PLCStatic.IsViewEnabled) {

View File

@ -57,7 +57,8 @@ namespace ILSOS_CCW_H52A
public override string GetEquipmentName() 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) public void OnSetAlarm(int code, bool isHeavy)

View File

@ -25,11 +25,10 @@ using System.Windows.Controls;
using Aurora.Api.Manager; using Aurora.Api.Manager;
using System.Windows; using System.Windows;
using WeldingCommon.Recipes; using WeldingCommon.Recipes;
using AuroraPLC.Views;
namespace ILSOS_CCW_H52A.Views namespace ILSOS_CCW_H52A.Views {
{ public class UCMainAutoRunViewModel : NotifyPropertyChangedBase {
public class UCMainAutoRunViewModel : NotifyPropertyChangedBase
{
private readonly Logger Log = new Logger("UCMainAutoRunViewModel"); private readonly Logger Log = new Logger("UCMainAutoRunViewModel");
public ICommand CMD_VisibleChanged { get; } public ICommand CMD_VisibleChanged { get; }
@ -79,6 +78,7 @@ namespace ILSOS_CCW_H52A.Views
_SeqAutoRun = _Aurora.SequenceEntry[SequenceIds.SeqAutoRunCCWH52A]; _SeqAutoRun = _Aurora.SequenceEntry[SequenceIds.SeqAutoRunCCWH52A];
_SeqAutoRun.RunStateChanged += AutoRunSeq_RunStateChanged; _SeqAutoRun.RunStateChanged += AutoRunSeq_RunStateChanged;
UCPLCBitViewModel.OnPermissionChanged += Login_StateChanged; // CMY - Permission 이 변경되면 Recipe Lock Event (On/Off)
InitVariable(); InitVariable();
@ -253,18 +253,33 @@ namespace ILSOS_CCW_H52A.Views
return; 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) private void AutoRunSeq_RunStateChanged(object sender, (string sequenceId, SequenceRunState state) e)
{ {
bool LoginState = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3;
//AutoRun 상황에서 Recipe Save Lock //AutoRun 상황에서 Recipe Save Lock
_RecipeManager.SaveLock( _RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, e.state != SequenceRunState.Idle);
CommonRecipeIds.ScannerObjectTeaching,
e.state != SequenceRunState.Idle);
//AutoRun 상황에서 Reicpe 화면 수정할 수 없도록 함 //AutoRun 상황에서 Reicpe 화면 수정할 수 없도록 함
if (e.state == SequenceRunState.Running) { if (e.state == SequenceRunState.Running) {
Application.Current.Dispatcher.InvokeAsync(() => { Application.Current.Dispatcher.InvokeAsync(() => {
_UCRecipe.IsEnabled = false; _UCRecipe.IsEnabled = false;
}); });
} else if (LoginState == LogOut) {
Application.Current.Dispatcher.InvokeAsync(() => {
_UCRecipe.IsEnabled = false; // CMY - 로그아웃 상태면 Auto가 풀려도 Recipe lock이 풀리지 않는다.
});
} else { } else {
Application.Current.Dispatcher.InvokeAsync(() => { Application.Current.Dispatcher.InvokeAsync(() => {
_UCRecipe.IsEnabled = true; _UCRecipe.IsEnabled = true;

View File

@ -86,7 +86,7 @@ namespace CoreUnit.Scanner.UserControl.Canvas.Dialog
btnOk.Enabled = false; btnOk.Enabled = false;
btnCancel.Enabled = true; 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)"; label58.Text = "(0~4000)";
label31.Text = "(0~4000)"; label31.Text = "(0~4000)";
label32.Text = "(0~10000)"; label32.Text = "(0~10000)";
@ -182,7 +182,7 @@ namespace CoreUnit.Scanner.UserControl.Canvas.Dialog
nudRampingEndPower2.Visible = false; nudRampingEndPower2.Visible = false;
#endregion #endregion
} //}
//Welding Paramter 색 지정 //Welding Paramter 색 지정
//rbParam1.ForeColor = Color.FromName(((WeldingParameterIDEditor.eWeldingColor)1).ToString()); //rbParam1.ForeColor = Color.FromName(((WeldingParameterIDEditor.eWeldingColor)1).ToString());