From 2ec034d375968ea06413fb7c4a520eff6bb7d66f Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:54:58 +0100 Subject: [PATCH 01/10] fixies an issue with string localization in dialog --- .../AxoDialogDialogView.razor | 4 +-- .../templates/starterunit/GroundSequence.st | 25 ++++++++++++++++--- .../server/StarterUnitTemplate.razor | 4 +-- src/templates.simple/axosimple.sln | 8 +++--- .../axpansion/server/Components/Unit.razor | 4 +-- .../Context.UnitTemplate/A.json | 14 +++++------ .../twin/Resources/PlcStringResources.resx | 12 ++++++--- src/traversals/apax/ix/apax_traversal.csproj | 2 ++ 8 files changed, 49 insertions(+), 24 deletions(-) diff --git a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor index 84a42bf64..1d9a64651 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor +++ b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor @@ -7,12 +7,12 @@
@RenderDialogIcon() -

@PlcLocalizer[Component._caption.Cyclic]

+

@Component._caption.GetCyclic()

@RenderDialogIcon()
-

@PlcLocalizer[@Component._text.Cyclic]

+

@Component._text.GetCyclic()

diff --git a/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st b/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st index 2a9f43f69..7d84b8f74 100644 --- a/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st +++ b/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st @@ -54,6 +54,7 @@ NAMESPACE axosimple.StarterUnitTemplate VAR taskState : AXOpen.Core.IAxoTaskState; forIterator : INT; + _dialogAnswer : eDialogAnswer; END_VAR; // IF (Components = NULL OR ProcessData = NULL) THEN // RETURN; @@ -64,9 +65,26 @@ NAMESPACE axosimple.StarterUnitTemplate // This sets the sequence to run once (top-botton) and stops with done after closing. THIS.SequenceMode := eAxoSequenceMode#RunOnce; + IF (Steps[0].Execute(THIS, TRUE, '<#DIALOG#>')) THEN + //------------------------------------------------------- + + _dialogAnswer := Objs^._dialog.Show(THIS).WithCaption('<#DO YOU WANT TO RUN THE GROUND MODE SEQUENCE?#>').WithYesNo().WithType(eDialogType#Warning).Answer(); + + IF(_dialogAnswer <> eDialogAnswer#NoAnswer) THEN + IF(_dialogAnswer = eDialogAnswer#Yes) THEN + THIS.MoveNext(); + END_IF; + + IF(_dialogAnswer = eDialogAnswer#No) THEN + THIS.Restore(); + END_IF; + END_IF; + //------------------------------------------------------- + END_IF; + // This is more verbose but also more versatile way of executing step logic. - IF (Steps[0].Execute(THIS, TRUE, '<#RESTORE#>')) THEN - //------------------------------------------------------- + IF (Steps[1].Execute(THIS, TRUE, '<#RESTORE#>')) THEN + //------------------------------------------------------- TechnologySettingsManager^.Restore(); ProcessSettingsManager^.Restore(); ProcessDataManager^.Restore(); @@ -79,7 +97,8 @@ NAMESPACE axosimple.StarterUnitTemplate //------------------------------------------------------- END_IF; - IF (Steps[1].Execute(THIS, TRUE, '<#READ PERSISTENT SETTINGS#>')) THEN + + IF (Steps[2].Execute(THIS, TRUE, '<#READ PERSISTENT SETTINGS#>')) THEN //------------------------------------------------------- IF CurrentStep.IsFirstEntryToStep() THEN ;// some special initialization diff --git a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor index b5f34e2ae..bb9237ee8 100644 --- a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor +++ b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor @@ -44,12 +44,12 @@ DataManger="Entry.Plc.Context.StarterUnitTemplateProcessData" Data="Entry.Plc.Context.StarterUnitTemplateProcessData.DataManger.Payload" DataHeader="Entry.Plc.Context.StarterUnitTemplateProcessData.Shared.Entity" - UnitComponents="Entry.Plc.Context.UnitTemplateComponents" + UnitComponents="Entry.Plc.Context.StarterUnitTemplateComponents" AditionalItems="new ITwinObject[] { Entry.Plc.Context.Safety.Zone_1, Entry.Plc.Context.Safety.Zone_2 }"> @code { - private axosimple.UnitTemplate.Unit Unit => Entry.Plc.Context.UnitTemplate; + private axosimple.StarterUnitTemplate.Unit Unit => Entry.Plc.Context.StarterUnitTemplate; } \ No newline at end of file diff --git a/src/templates.simple/axosimple.sln b/src/templates.simple/axosimple.sln index 2b91d7cb1..4e41670a9 100644 --- a/src/templates.simple/axosimple.sln +++ b/src/templates.simple/axosimple.sln @@ -47,9 +47,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Data.Json", "..\data EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Data.MongoDb", "..\data\src\repositories\MongoDb\AXOpen.Data.MongoDb.csproj", "{6600F42A-C561-41A5-BB6B-2C93613DB92E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Inspectors.Blazor", "..\inspectors\src\AXOpen.Inspectors.blazor\AXOpen.Inspectors.Blazor.csproj", "{286B0C9D-2B65-4C10-B7D2-19052C559ACC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxOpen.Inspectors.Blazor", "..\inspectors\src\AxOpen.Inspectors.Blazor\AxOpen.Inspectors.Blazor.csproj", "{286B0C9D-2B65-4C10-B7D2-19052C559ACC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_inspectors", "..\inspectors\src\AXOpen.Inspectors\ix_ax_axopen_inspectors.csproj", "{21BC94A1-E2EE-46A8-B062-45581DF36A3E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_inspectors", "..\inspectors\src\AxOpen.Inspectors\ix_ax_axopen_inspectors.csproj", "{21BC94A1-E2EE-46A8-B062-45581DF36A3E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_io", "..\io\src\AXOpen.Io\ix_ax_axopen_io.csproj", "{3C46ABB6-689C-450A-9019-C727F9CA2EF8}" EndProject @@ -185,9 +185,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\data\src", "{3D88 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "..\data", "{304A1345-06E0-403C-8FDD-07E4E82B69F5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Inspectors.blazor", "..\inspectors\src\AXOpen.Inspectors.blazor", "{6ABF1453-EE1B-43AD-9956-66FCDBC6428B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AxOpen.Inspectors.Blazor", "..\inspectors\src\AxOpen.Inspectors.Blazor", "{6ABF1453-EE1B-43AD-9956-66FCDBC6428B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Inspectors", "..\inspectors\src\AXOpen.Inspectors", "{4897CCA0-CFDA-41BB-9A85-407C24602406}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AxOpen.Inspectors", "..\inspectors\src\AxOpen.Inspectors", "{4897CCA0-CFDA-41BB-9A85-407C24602406}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\inspectors\src", "{5EE332D8-0C90-4411-82D2-015EAD1835AD}" EndProject diff --git a/src/templates.simple/axpansion/server/Components/Unit.razor b/src/templates.simple/axpansion/server/Components/Unit.razor index d163e9487..ac0ff29c2 100644 --- a/src/templates.simple/axpansion/server/Components/Unit.razor +++ b/src/templates.simple/axpansion/server/Components/Unit.razor @@ -134,6 +134,6 @@
- - + + diff --git a/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.UnitTemplate/A.json b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.UnitTemplate/A.json index c6c3778c1..606ab981e 100644 --- a/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.UnitTemplate/A.json +++ b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.UnitTemplate/A.json @@ -7,8 +7,8 @@ "Items": [ { "Id": "f21502b7b86f1bdb2606b5aee9f26d9f8ae23c584aed42b78e371dfe7a0604b8", - "Left": 50.01572327044025, - "Top": 76.4804469273743, + "Left": 49.938563371982674, + "Top": 58.78480375933292, "Transform": "TopCenter", "Presentation": "Spot", "Width": -1, @@ -22,8 +22,8 @@ }, { "Id": "357da12e47a3aa5214b0e4485d3906e1b9132f95e94a34dc18686e7190dcc789", - "Left": 29.103773584905664, - "Top": 17.541899441340785, + "Left": 18.224227902387774, + "Top": 12.603580417701327, "Transform": "TopCenter", "Presentation": "Spot", "Width": -1, @@ -31,14 +31,14 @@ "ZIndex": 0, "Scale": 1, "Roles": "", - "PresentationTemplate": null, + "PresentationTemplate": "", "Background": true, "BackgroundColor": "#FFFFFF" }, { "Id": "789dbd3ceeadd5575187ca3fd6b38cc6f9090f709f8308ce40a99f84197dfa07", - "Left": 83.74213836477988, - "Top": 53.71508379888269, + "Left": 76.56626780822553, + "Top": 16.266164536283462, "Transform": "TopCenter", "Presentation": "Spot", "Width": -1, diff --git a/src/templates.simple/axpansion/twin/Resources/PlcStringResources.resx b/src/templates.simple/axpansion/twin/Resources/PlcStringResources.resx index a4e90cdb5..bbd8bdada 100644 --- a/src/templates.simple/axpansion/twin/Resources/PlcStringResources.resx +++ b/src/templates.simple/axpansion/twin/Resources/PlcStringResources.resx @@ -158,21 +158,25 @@ AUTOMAT src\templates\starterunit\AutomatSequence.st,10 + + DIALOG + src\templates\starterunit\GroundSequence.st,67 + RESTORE - src\templates\starterunit\GroundSequence.st,67 + src\templates\starterunit\GroundSequence.st,85 READ PERSISTENT SETTINGS - src\templates\starterunit\GroundSequence.st,81 + src\templates\starterunit\GroundSequence.st,100 READ TECHNOLOGY SETTINS - src\templates\starterunit\GroundSequence.st,127 + src\templates\starterunit\GroundSequence.st,146 SAVE DATA - src\templates\starterunit\GroundSequence.st,169 + src\templates\starterunit\GroundSequence.st,188 GROUND diff --git a/src/traversals/apax/ix/apax_traversal.csproj b/src/traversals/apax/ix/apax_traversal.csproj index 43c35c4be..43ebaf7fc 100644 --- a/src/traversals/apax/ix/apax_traversal.csproj +++ b/src/traversals/apax/ix/apax_traversal.csproj @@ -71,5 +71,7 @@ + + \ No newline at end of file From 3c972da462f0db8e5824c1d3c00fdcb2a5188f3f Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:56:30 +0100 Subject: [PATCH 02/10] mend --- ...ntext.StarterUnitTemplate.ServiceMode.json | 4 ++ .../default.json | 59 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode.json create mode 100644 src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode/default.json diff --git a/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode.json b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode.json new file mode 100644 index 000000000..4f2ddbf24 --- /dev/null +++ b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode.json @@ -0,0 +1,4 @@ +{ + "Views": [], + "DefaultView": "default" +} \ No newline at end of file diff --git a/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode/default.json b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode/default.json new file mode 100644 index 000000000..de0fda384 --- /dev/null +++ b/src/templates.simple/axpansion/server/VisualComposerSerialize/Context.StarterUnitTemplate.ServiceMode/default.json @@ -0,0 +1,59 @@ +{ + "ImgSrc": null, + "BackgroundWidth": 100, + "BackgroundHeight": 200, + "EmptyBackground": true, + "BackgroundColor": "#ebeaea", + "Items": [ + { + "Id": "d4adaeecea3b6ffad114d37e94fbf37c2b27290f21f1c59554227a6ef3ea8ecd", + "Left": 10, + "Top": 10, + "Transform": "TopCenter", + "Presentation": "Status-Display", + "Width": -1, + "Height": -1, + "ZIndex": 0, + "Scale": 1, + "Roles": "", + "PresentationTemplate": null, + "Background": false, + "BackgroundColor": "#FFFFFF" + }, + { + "Id": "3d80a6735bf45a502b9c1a397f2ad7e9938eb10031806b2a7e18c4884275fabe", + "Left": 78.43354430379746, + "Top": 1.6334661354581672, + "Transform": "TopCenter", + "Presentation": "Status-Display", + "Width": -1, + "Height": -1, + "ZIndex": 0, + "Scale": 1, + "Roles": "", + "PresentationTemplate": null, + "Background": false, + "BackgroundColor": "#FFFFFF" + }, + { + "Id": "27c78cca5a92bc574d8fe5c2994d282d6533737d2821bc1f71f4ccef1e8542a5", + "Left": 43.54430379746835, + "Top": 0.6374501992031876, + "Transform": "TopCenter", + "Presentation": "Status-Display", + "Width": -1, + "Height": -1, + "ZIndex": 0, + "Scale": 1, + "Roles": "", + "PresentationTemplate": null, + "Background": false, + "BackgroundColor": "#FFFFFF" + } + ], + "Theme": "text-dark", + "Scale": 1, + "TranslateX": 0, + "TranslateY": 0, + "AllowZoomingAndPanning": true +} \ No newline at end of file From 81817a6c1ba83a299eded902c3298c1d55ae8b67 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:18:13 +0100 Subject: [PATCH 03/10] wip --- .../ax/src/templates/starterunit/Comonents.st | 16 +-- .../src/templates/starterunit/ServiceMode.st | 6 +- .../server/StarterUnitTemplate.razor | 19 ++- .../starterunit/twin/StarterUnitTemplate.cs | 59 +++++++- .../templates/unit/server/UnitTemplate.razor | 17 +-- .../unit/twin/UnitTemplateServices.cs | 54 +++++++- .../axpansion/server/Components/Unit.razor | 37 ++--- .../axpansion/server/Components/Unit.razor.cs | 130 +++++++++--------- .../server/Components/UnitLinkView.razor | 41 +----- .../server/Components/UnitSpotView.razor | 6 +- .../server/Pages/Context/Units/Units.razor | 9 +- .../axpansion/server/Program.cs | 9 +- .../axpansion/server/StandardUnit.cs | 11 +- .../default.json | 48 +++++-- .../Context.UnitTemplate.ServiceMode/A.json | 57 +++++++- .../Context.UnitTemplate.ServiceMode/B.json | 2 +- .../Context.UnitTemplate/B.json | 62 ++++++++- .../axpansion/twin/BaseUnit/Unit.cs | 16 +++ .../axpansion/twin/Context/Context.cs | 24 ++-- .../twin/Context/Units/IUnitServices.cs | 32 +++++ .../twin/Resources/PlcStringResources.resx | 4 + .../axpansion/twin/axosimple.csproj | 1 - 22 files changed, 460 insertions(+), 200 deletions(-) create mode 100644 src/templates.simple/axpansion/twin/BaseUnit/Unit.cs create mode 100644 src/templates.simple/axpansion/twin/Context/Units/IUnitServices.cs diff --git a/src/templates.simple/ax/src/templates/starterunit/Comonents.st b/src/templates.simple/ax/src/templates/starterunit/Comonents.st index 088080af0..1368867a2 100644 --- a/src/templates.simple/ax/src/templates/starterunit/Comonents.st +++ b/src/templates.simple/ax/src/templates/starterunit/Comonents.st @@ -12,11 +12,11 @@ NAMESPACE axosimple.StarterUnitTemplate EXTENDS AXOpen.Core.AxoObject VAR PUBLIC // HERE DECLARE COMPONENTS USED BY THIS CONTROLLED UNIT - // HorizontalCylinder : AXOpen.Components.Pneumatics.AxoCylinder; - // VerticalCylinder : AXOpen.Components.Pneumatics.AxoCylinder; - // GripperCylinder : AXOpen.Components.Pneumatics.AxoCylinder; - // DMCReader : AXOpen.Components.Cognex.Vision.v_6_0_0_0.AxoDataman; - // PartPresenceSensor : AXOpen.Elements.AxoDi; + HorizontalCylinder : AXOpen.Components.Pneumatics.AxoCylinder; + VerticalCylinder : AXOpen.Components.Pneumatics.AxoCylinder; + GripperCylinder : AXOpen.Components.Pneumatics.AxoCylinder; + DMCReader : AXOpen.Components.Cognex.Vision.v_6_0_0_0.AxoDataman; + PartPresenceSensor : AXOpen.Elements.AxoDi; END_VAR METHOD PUBLIC Update @@ -29,9 +29,9 @@ NAMESPACE axosimple.StarterUnitTemplate END_VAR THIS.Initialize(parent); // HERE INITIALIZE YOUR COMPONENTS - // HorizontalCylinder.Run(THIS, Inputs.B0[0], Inputs.B0[1], Outputs.B0[0], Outputs.B0[1]); - // VerticalCylinder.Run(THIS, Inputs.B0[2], Inputs.B0[3], Outputs.B0[2], Outputs.B0[3]); - // GripperCylinder.Run(THIS, Inputs.B0[4], Inputs.B0[5], Outputs.B0[4], Outputs.B0[5]); + HorizontalCylinder.Run(THIS, Inputs.P0[0], Inputs.P0[1], Outputs.P0[0], Outputs.P0[1]); + VerticalCylinder.Run(THIS, Inputs.P0[2], Inputs.P0[3], Outputs.P0[2], Outputs.P0[3]); + GripperCylinder.Run(THIS, Inputs.P0[4], Inputs.P0[5], Outputs.P0[4], Outputs.P0[5]); END_METHOD END_CLASS END_NAMESPACE diff --git a/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st b/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st index 00100271e..24a835ca4 100644 --- a/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st +++ b/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st @@ -35,9 +35,9 @@ NAMESPACE axosimple.StarterUnitTemplate END_VAR ; // HERE CALL LOGIC FOR MANUAL/SERICE OPERATIONS - // components.HorizontalCylinder.ActivateManualControl(); - // components.VerticalCylinder.ActivateManualControl(); - // components.GripperCylinder.ActivateManualControl(); + components.HorizontalCylinder.ActivateManualControl(); + components.VerticalCylinder.ActivateManualControl(); + components.GripperCylinder.ActivateManualControl(); END_METHOD END_CLASS END_NAMESPACE diff --git a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor index bb9237ee8..bf7ac1ae6 100644 --- a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor +++ b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor @@ -5,6 +5,8 @@ @using AXOpen.VisualComposer; @using AXSharp.Connector; @using AXOpen.Core; +@using axosimple.server.Units +@using Context = axosimple.Context @inject IAlertService _alerts @inherits RenderableComplexComponentBase @@ -38,18 +40,13 @@
- - - + + @code { - private axosimple.StarterUnitTemplate.Unit Unit => Entry.Plc.Context.StarterUnitTemplate; + private StarterUnitTemplateServices Services => ContextService.Instance.StarterUnitTemplateServices; + private axosimple.StarterUnitTemplate.Unit? Unit { + get { return ContextService.Instance.StarterUnitTemplateServices.Unit as axosimple.StarterUnitTemplate.Unit; } + } } \ No newline at end of file diff --git a/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs b/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs index 17e6cf44c..622b8dc1d 100644 --- a/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs +++ b/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs @@ -1,16 +1,62 @@ -using AXOpen.Base.Data; +using System.Runtime.CompilerServices; +using AXOpen.Base.Data; +using AXOpen.Messaging.Static; using axosimple; +using AXSharp.Connector; + + namespace axosimple.server.Units { - public class StarterUnitTemplateServices + public class StarterUnitTemplateServices : IUnitServices { private StarterUnitTemplateServices(ContextService contextService) { _contextService = contextService; } + + public AXOpen.Data.AxoDataEntity? Data { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData.DataManger.Payload; + + public AXOpen.Data.AxoDataEntity? DataHeader { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData.Shared.Entity; + + public AXOpen.Data.AxoDataExchangeBase? DataManger { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData; + + public AXOpen.Data.AxoDataEntity? TechnologySettings { get; } = + Entry.Plc.Context.StarterUnitTemplateTechnologySettings.Shared.Entity; + + public AXOpen.Data.AxoDataEntity? SharedTechnologySettings { get; } = + Entry.Plc.Context.StarterUnitTemplateTechnologySettings.DataManger.Payload; + + public AxoObject? UnitComponents => Entry.Plc.Context.StarterUnitTemplateComponents; + + public ITwinObject[] Associates => new ITwinObject[] + { + SharedTechnologySettings, + TechnologySettings, + DataManger, + Data, + DataHeader, + UnitComponents, + Entry.Plc.Context.Safety.Zone_1, + Entry.Plc.Context.Safety.Zone_2 + }; + + private AxoMessageProvider _messageProvider; + + public AxoMessageProvider MessageProvider + { + get + { + if (_messageProvider == null) + { + _messageProvider = AxoMessageProvider.Create(Associates); + } + + return _messageProvider; + } + } - private StarterUnitTemplate.Unit Unit { get; } = Entry.Plc.Context.StarterUnitTemplate; + public axosimple.BaseUnit.Unit Unit { get; } = Entry.Plc.Context.StarterUnitTemplate; // Technology Data manager of unit private StarterUnitTemplate.TechnologyDataManager StarterUnitTechnologyDataManager { get; } = @@ -41,10 +87,11 @@ private StarterUnitTemplateServices(ContextService contextService) public static StarterUnitTemplateServices Create(ContextService contextService) { var retVal = new StarterUnitTemplateServices(contextService); + retVal.Unit.UnitServices = retVal; return retVal; } - public void SetUnitsData( + public StarterUnitTemplateServices SetUnitsData( IRepository technologySettingsRepository, IRepository processSettingsRepository, IRepository processDataRepository @@ -68,7 +115,9 @@ public void SetUnitsData( StarterUnitTechnologyDataManager.Shared.InitializeRemoteDataExchange(_contextService.TechnologyCommonRepository); StarterUnitTechnologyDataManager.DataManger.InitializeRemoteDataExchange(TechnologySettingsRepository); StarterUnitTechnologyDataManager.InitializeRemoteDataExchange(); - + + return this; + } } } diff --git a/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor b/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor index d4b9bea37..1e2983fa5 100644 --- a/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor +++ b/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor @@ -5,6 +5,7 @@ @using AXOpen.VisualComposer; @using AXSharp.Connector; @using AXOpen.Core; +@using axosimple.server.Units @inject IAlertService _alerts @inherits RenderableComplexComponentBase @@ -36,17 +37,13 @@ - - + + @code { - private axosimple.UnitTemplate.Unit Unit => Entry.Plc.Context.UnitTemplate; + private UnitTemplateServices Services => ContextService.Instance.UnitTemplateServices; + private axosimple.UnitTemplate.Unit Unit { + get { return (dynamic)ContextService.Instance.UnitTemplateServices.Unit; } + } } diff --git a/src/templates.simple/ax/src/templates/unit/twin/UnitTemplateServices.cs b/src/templates.simple/ax/src/templates/unit/twin/UnitTemplateServices.cs index 35eb1fbb3..4228eee25 100644 --- a/src/templates.simple/ax/src/templates/unit/twin/UnitTemplateServices.cs +++ b/src/templates.simple/ax/src/templates/unit/twin/UnitTemplateServices.cs @@ -1,16 +1,60 @@ using AXOpen.Base.Data; +using AXOpen.Messaging.Static; using axosimple; +using AXSharp.Connector; namespace axosimple.server.Units { - public class UnitTemplateServices + public class UnitTemplateServices : IUnitServices { private UnitTemplateServices(ContextService contextService) { _contextService = contextService; } - private UnitTemplate.Unit Unit { get; } = Entry.Plc.Context.UnitTemplate; + public AXOpen.Data.AxoDataEntity? Data { get; } = Entry.Plc.Context.UnitTemplateProcessData.DataManger.Payload; + + public AXOpen.Data.AxoDataEntity? DataHeader { get; } = Entry.Plc.Context.UnitTemplateProcessData.Shared.Entity; + + public AXOpen.Data.AxoDataExchangeBase? DataManger { get; } = Entry.Plc.Context.UnitTemplateProcessData; + + public AXOpen.Data.AxoDataEntity? TechnologySettings { get; } = + Entry.Plc.Context.UnitTemplateTechnologySettings.Shared.Entity; + + public AXOpen.Data.AxoDataEntity? SharedTechnologySettings { get; } = + Entry.Plc.Context.UnitTemplateTechnologySettings.DataManger.Payload; + + public AxoObject? UnitComponents => Entry.Plc.Context.UnitTemplateComponents; + + public ITwinObject[] Associates => new ITwinObject[] + { + SharedTechnologySettings, + TechnologySettings, + DataManger, + Data, + DataHeader, + UnitComponents, + Entry.Plc.Context.Safety.Zone_1, + Entry.Plc.Context.Safety.Zone_2 + }; + + private AxoMessageProvider _messageProvider; + + public AxoMessageProvider MessageProvider + { + get + { + if (_messageProvider == null) + { + _messageProvider = AxoMessageProvider.Create(Associates); + } + + return _messageProvider; + } + } + + + public axosimple.BaseUnit.Unit Unit { get; } = Entry.Plc.Context.UnitTemplate; // Technology Data manager of unit private UnitTemplate.TechnologyDataManager UnitTechnologyDataManager { get; } = @@ -41,10 +85,11 @@ private UnitTemplateServices(ContextService contextService) public static UnitTemplateServices Create(ContextService contextService) { var retVal = new UnitTemplateServices(contextService); + retVal.Unit.UnitServices = retVal; return retVal; } - public void SetUnitsData( + public UnitTemplateServices SetUnitsData( IRepository technologySettingsRepository, IRepository processSettingsRepository, IRepository processDataRepository @@ -68,7 +113,8 @@ public void SetUnitsData( UnitTechnologyDataManager.Shared.InitializeRemoteDataExchange(_contextService.TechnologyCommonRepository); UnitTechnologyDataManager.DataManger.InitializeRemoteDataExchange(TechnologySettingsRepository); UnitTechnologyDataManager.InitializeRemoteDataExchange(); - + + return this; } } } diff --git a/src/templates.simple/axpansion/server/Components/Unit.razor b/src/templates.simple/axpansion/server/Components/Unit.razor index ac0ff29c2..1688f3215 100644 --- a/src/templates.simple/axpansion/server/Components/Unit.razor +++ b/src/templates.simple/axpansion/server/Components/Unit.razor @@ -1,19 +1,20 @@ @using AXSharp.Connector @using AXOpen.Core @using AXOpen.VisualComposer; -@inherits RenderableComplexComponentBase +@using axosimple.server.Pages.Settings +@inherits ComponentBase
@*
*@ @* *@ @*
*@ - - + +
@@ -24,15 +25,15 @@