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_ChangeValue { get; }
public static event Action<ushort> 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) {

View File

@ -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)

View File

@ -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;

View File

@ -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());