diff --git a/scripts/test_L1.ps1 b/scripts/test_L1.ps1 index 88c282523..611d7d5bc 100644 --- a/scripts/test_L1.ps1 +++ b/scripts/test_L1.ps1 @@ -1,4 +1,4 @@ # run build -dotnet run --project cake/Build.csproj --do-test --test-level 1 +dotnet run --project cake/Build.csproj --do-test --test-level 1 -x exit $LASTEXITCODE; \ No newline at end of file diff --git a/src/components.drives/app/ix-blazor/Program.cs b/src/components.drives/app/ix-blazor/Program.cs index c22322f00..6721de5f3 100644 --- a/src/components.drives/app/ix-blazor/Program.cs +++ b/src/components.drives/app/ix-blazor/Program.cs @@ -28,8 +28,8 @@ Entry.Plc.Connector.SubscriptionMode = ReadSubscriptionMode.Polling; Entry.Plc.Connector.BuildAndStart().ReadWriteCycleDelay = 250; -Entry.Plc.Connector.ConcurrentRequestMaxCount = 4; -Entry.Plc.Connector.ConcurrentRequestDelay = 100; +Entry.Plc.Connector.ConcurrentRequestMaxCount = 4; +Entry.Plc.Connector.ConcurrentRequestDelay = 100; Entry.Plc.Connector.SetLoggerConfiguration(new LoggerConfiguration() .WriteTo .Console() @@ -105,4 +105,4 @@ public static List CreateRoles() public const string process_settings_access = nameof(process_settings_access); public const string process_traceability_access = nameof(process_traceability_access); public const string can_skip_steps_in_sequence = nameof(can_skip_steps_in_sequence); -} +} \ No newline at end of file diff --git a/src/core/ctrl/src/AxoTask/AxoTask.st b/src/core/ctrl/src/AxoTask/AxoTask.st index 25227e26f..7f9ce06a9 100644 --- a/src/core/ctrl/src/AxoTask/AxoTask.st +++ b/src/core/ctrl/src/AxoTask/AxoTask.st @@ -86,6 +86,8 @@ NAMESPACE AXOpen.Core {#ix-set:Help = "<#Check task calling in the code, task is called more then once.#>"} _MultipleExecuteIsCalled : AXOpen.Messaging.Static.AxoMessenger; _SuspendMultipleExecuteCallCheck : BOOL := FALSE; + _RemoteRestoreEnabled : BOOL := TRUE; + _RemoteAbortEnabled : BOOL := FALSE; END_VAR /// @@ -417,8 +419,16 @@ NAMESPACE AXOpen.Core IF(_context_ = NULL) THEN RETURN; END_IF; IF( RemoteInvoke) THEN THIS.Invoke(); RemoteInvoke := FALSE; END_IF; - IF( RemoteRestore) THEN THIS.Restore(); RemoteRestore := FALSE; END_IF; - IF( RemoteAbort) THEN THIS.Abort(); RemoteAbort := FALSE; END_IF; + IF _RemoteRestoreEnabled THEN + IF( RemoteRestore) THEN THIS.Restore(); RemoteRestore := FALSE; END_IF; + ELSE + RemoteRestore := FALSE; + END_IF; + IF _RemoteAbortEnabled THEN + IF( RemoteAbort ) THEN THIS.Abort(); RemoteAbort := FALSE; END_IF; + ELSE + RemoteAbort := FALSE; + END_IF; IF( RemoteResume) THEN THIS.Resume(); RemoteResume := FALSE; END_IF; _MultipleExecuteIsCalled.Serve(THIS); @@ -431,6 +441,7 @@ NAMESPACE AXOpen.Core END_IF; END_IF; _openCycleCountExecute := _openCycleCount; + // If the Invoke() method was called in more then one PLC cycle back without calling the Execute() method // and the Execute() is subsequently called without calling the Invoke() method in the same PLC cycle, @@ -479,6 +490,7 @@ NAMESPACE AXOpen.Core END_IF; END_IF; + THIS.UpdateState(); Execute := Status = eAxoTaskState#Busy; _taskTimer.OnDelay(THIS, Execute, LT#99999D); @@ -570,6 +582,66 @@ NAMESPACE AXOpen.Core END_IF; END_METHOD + /// + /// Sets the remote restore functionality based on the provided input. + /// Enables or disables remote restoration based on the value of the 'Enable' parameter. + /// + ///A boolean value indicating whether remote restore functionality should be enabled (TRUE) or disabled (FALSE). + /// + /// This method allows dynamic control over the ability to perform remote restoration tasks. + /// When enabled, remote restoration functionality is activated, allowing tasks to be restored remotely. + /// When disabled, remote restoration functionality is deactivated, preventing tasks from being restored remotely. + /// + METHOD PUBLIC SetRemoteRestoreEnabled + VAR_INPUT + Enable : BOOL; // Input parameter to enable or disable remote restore. + END_VAR + _RemoteRestoreEnabled := Enable; // Assign the input value to the variable. + END_METHOD + + /// + /// Retrieves the current status of remote restore functionality. + /// + ///A boolean value indicating whether remote restore functionality is enabled (TRUE) or disabled (FALSE). + /// + /// This method provides the current status of remote restore functionality. + /// It returns TRUE if remote restoration is enabled, allowing tasks to be restored remotely. + /// It returns FALSE if remote restoration is disabled, preventing tasks from being restored remotely. + /// + METHOD PUBLIC GetRemoteRestoreEnabled : BOOL + GetRemoteRestoreEnabled := _RemoteRestoreEnabled; // Returns the current status of remote restore functionality. + END_METHOD + + /// + /// Sets the remote abort functionality based on the provided input. + /// Enables or disables remote abort based on the value of the 'Enable' parameter. + /// + ///A boolean value indicating whether remote abort functionality should be enabled (TRUE) or disabled (FALSE). + /// + /// This method allows dynamic control over the ability to perform remote abort tasks. + /// When enabled, remote abort functionality is activated, allowing tasks to be aborted remotely. + /// When disabled, remote abort functionality is deactivated, preventing tasks from being aborted remotely. + /// + METHOD PUBLIC SetRemoteAbortEnabled + VAR_INPUT + Enable : BOOL; // Input parameter to enable or disable remote abort. + END_VAR + _RemoteAbortEnabled := Enable; // Assign the input value to the variable. + END_METHOD + + /// + /// Retrieves the current status of remote abort functionality. + /// + ///A boolean value indicating whether remote abort functionality is enabled (TRUE) or disabled (FALSE). + /// + /// This method provides the current status of remote abort functionality. + /// It returns TRUE if remote abort is enabled, allowing tasks to be aborted remotely. + /// It returns FALSE if remote abort is disabled, preventing tasks from being aborted remotely. + /// + METHOD PUBLIC GetRemoteAbortEnabled : BOOL + GetRemoteAbortEnabled := _RemoteAbortEnabled; // Returns the current status of remote abort functionality. + END_METHOD + /// /// Executes once when the task is aborted. /// diff --git a/src/core/ctrl/test/AxoTask/AxoTaskTests.st b/src/core/ctrl/test/AxoTask/AxoTaskTests.st index 02e363e23..2b2c47b01 100644 --- a/src/core/ctrl/test/AxoTask/AxoTaskTests.st +++ b/src/core/ctrl/test/AxoTask/AxoTaskTests.st @@ -897,5 +897,95 @@ NAMESPACE AXOpen.Core.AxoTask_Tests // Act/Assert Assert.Equal(FALSE, myTask.GetSuspendMultipleExecuteCallCheckState()); END_METHOD + {Test} + METHOD PUBLIC task_should_stay_at_busy_state_and_remote_abort_signal_should_be_reseted_as_the_abbility_to_abort_task_is_disabled_by_default + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + myTask.RemoteAbort := TRUE; + _context.Close(); + + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + Assert.Equal(TRUE,myTask.IsBusy()); + Assert.Equal(FALSE,myTask.RemoteAbort); + Assert.Equal(FALSE,myTask.GetRemoteAbortEnabled()); + END_METHOD + + {Test} + METHOD PUBLIC task_should_be_aborted + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + myTask.SetRemoteAbortEnabled(TRUE); + myTask.RemoteAbort := TRUE; + _context.Close(); + + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + Assert.Equal(TRUE,myTask.IsAborted()); + Assert.Equal(FALSE,myTask.RemoteAbort); + Assert.Equal(TRUE,myTask.GetRemoteAbortEnabled()); + END_METHOD + + {Test} + METHOD PUBLIC task_should_be_restored + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + myTask.RemoteRestore := TRUE; + _context.Close(); + + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + Assert.Equal(FALSE,myTask.IsBusy()); + Assert.Equal(TRUE,myTask.IsReady()); + Assert.Equal(FALSE,myTask.RemoteAbort); + Assert.Equal(TRUE,myTask.GetRemoteRestoreEnabled()); + END_METHOD + + {Test} + METHOD PUBLIC task_should_not_be_restored_as_the_remote_restore_is_disabled + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + myTask.SetRemoteRestoreEnabled(FALSE); + myTask.RemoteRestore := TRUE; + _context.Close(); + + THIS.Initialize(); + _context.Open(); + myTask.Invoke(); + myTask.Execute(); + Assert.Equal(TRUE,myTask.IsBusy()); + Assert.Equal(FALSE,myTask.IsReady()); + Assert.Equal(FALSE,myTask.RemoteAbort); + Assert.Equal(FALSE,myTask.GetRemoteRestoreEnabled()); + END_METHOD + + {Test} + METHOD PUBLIC task_should_not_be_remotely_abortable_by_default + THIS.Initialize(); + _context.Open(); + Assert.Equal(FALSE,myTask.GetRemoteAbortEnabled()); + END_METHOD + + {Test} + METHOD PUBLIC task_should_be_remotely_restorable_by_default + THIS.Initialize(); + _context.Open(); + Assert.Equal(TRUE,myTask.GetRemoteRestoreEnabled()); + // Assert.Equal(TRUE,FALSE); + END_METHOD END_CLASS END_NAMESPACE diff --git a/src/core/src/AXOpen.Core.Blazor/AxoComponent/AxoComponentView.razor.cs b/src/core/src/AXOpen.Core.Blazor/AxoComponent/AxoComponentView.razor.cs index 875da5858..3a2c9fca8 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoComponent/AxoComponentView.razor.cs +++ b/src/core/src/AXOpen.Core.Blazor/AxoComponent/AxoComponentView.razor.cs @@ -8,6 +8,7 @@ using Serilog; using AXSharp.Presentation.Blazor.Controls.RenderableContent; using System.Collections.Generic; +using AXOpen.ToolBox.Extensions; namespace AXOpen.Core { diff --git a/src/core/src/AXOpen.Core/Flattener.cs b/src/core/src/AXOpen.Core/Flattener.cs deleted file mode 100644 index 450dcaad6..000000000 --- a/src/core/src/AXOpen.Core/Flattener.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AXSharp.Connector; - -namespace AXOpen.Core -{ - public static class Flattener - { - public static IEnumerable Flatten( - this IEnumerable e - , Func> f - ) => e.SelectMany(c => f(c).Flatten(f)).Concat(e); - } -} diff --git a/src/templates.simple/axpansion/server/Components/UnitSpotView.razor b/src/templates.simple/axpansion/server/Components/UnitSpotView.razor index cba866b3d..6b2005958 100644 --- a/src/templates.simple/axpansion/server/Components/UnitSpotView.razor +++ b/src/templates.simple/axpansion/server/Components/UnitSpotView.razor @@ -2,6 +2,7 @@ @using AXOpen.Core @using AXOpen.Core.Blazor.Culture @using AXOpen.Messaging.Static +@using AXOpen.ToolBox.Extensions @inherits RenderableComplexComponentBase