diff --git a/scripts/build_test_docu.ps1 b/scripts/build_test_docu.ps1 index 0953a080b..1b0cc5fb3 100644 --- a/scripts/build_test_docu.ps1 +++ b/scripts/build_test_docu.ps1 @@ -9,6 +9,8 @@ dotnet ixd ` .\src\components.elements\ctrl ` .\src\components.rexroth.drives\ctrl ` .\src\components.festo.drives\ctrl ` +.\src\components.kuka.robotics\ctrl ` +.\src\components.mitsubishi.robotics\ctrl ` .\src\template.axolibrary\ctrl ` -o .\docfx\apictrl\ diff --git a/src/components.pneumatics/ctrl/apax.yml b/src/components.pneumatics/ctrl/apax.yml index 8218c0e3e..4faf63558 100644 --- a/src/components.pneumatics/ctrl/apax.yml +++ b/src/components.pneumatics/ctrl/apax.yml @@ -1,5 +1,5 @@ name: "@ix-ax/axopen.components.pneumatics" -version : '0.0.0-dev.0' +version: '0.0.0-dev.0' type: lib targets: - llvm @@ -12,9 +12,9 @@ variables: AXUNIT_TARGET_IP: "172.20.30.110" SIM_ENABLED: "true" devDependencies: - "@ix-ax/ax-sdk" : '0.0.0-dev.0' + "@ix-ax/ax-sdk": '0.0.0-dev.0' dependencies: - "@ix-ax/axopen.components.abstractions" : '0.0.0-dev.0' + "@ix-ax/axopen.components.abstractions": '0.0.0-dev.0' scripts: download: - START=$(date +%s) 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/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs b/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs index d72e16179..217b89901 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs +++ b/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs @@ -125,5 +125,11 @@ await Task.Run(() => { } }); } - + + public static async Task CreateAndInitialize(AxoMessageProvider provider, RenderableComponentBase unitBaseSpotView) + { + var observer = AxoMessageObserver.Create(provider, unitBaseSpotView); + await observer.InitializeUpdate(); + return observer; + } } \ No newline at end of file diff --git a/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor b/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor index 7eb869073..7fb29a167 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor +++ b/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor @@ -133,7 +133,7 @@ var ast = await AuthenticationStateProvider.GetAuthenticationStateAsync(); if (Observer?.Provider is {Messengers: not null }) { - foreach (var messenger in Observer.Provider.Messengers) + foreach (var messenger in Observer.Provider.Messengers.Where(p =>p.State == eAxoMessengerState.NotActiveWaitingAckn)) { messenger.Acknowledge(ast.User.Identity); } diff --git a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs index 1e258111a..1db52f8d1 100644 --- a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs +++ b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs @@ -17,6 +17,7 @@ using AXOpen.Data.MongoDb; using AXOpen.Data.Json; + var builder = WebApplication.CreateBuilder(args); var jsonRepositoryLocation = CreateJsonRepositoryDirectory(); @@ -58,11 +59,9 @@ //persistentRepository = new JsonRepositorySettings(persistentLocation).Factory(); // *** MONGO REPOSITORY *** -AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017", - mongoDatabaseName: "AxOpenData", - user: "user", - userpw: "userpwd"); -persistentRepository = AXOpen.Data.MongoDb.Repository.Factory("PersistentData"); + + +persistentRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "PersistentData")); Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange( @@ -87,12 +86,9 @@ //Station_1_DataRepository = new JsonRepositorySettings(Station_1_Location).Factory(); // *** MONGO REPOSITORY *** -AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017", - mongoDatabaseName: "AxOpenData", - user: "user", - userpw: "userpwd"); -SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory("SharedDataHeader"); -Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory("Station_1"); + +SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "SharedDataHeader")); +Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "Station_1")); var AxoProcessDataManager = Entry.Plc.AxoDataFragmentsExchangeContext.DataManager.CreateBuilder(); @@ -114,11 +110,9 @@ //AxoProcessDataRepository = new JsonRepositorySettings(ProcessDataLocation).Factory(); // *** MONGO REPOSITORY *** -AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017", - mongoDatabaseName: "AxOpenData", - user: "user", - userpw: "userpwd"); -AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory("AxoDataExchangeExample"); + + +AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData","AxoDataExchangeExample")); Entry.Plc.AxoDataExchangeContext.DataManager.InitializeRemoteDataExchange(AxoProcessDataRepository); // diff --git a/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs b/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs index 8a76c417b..7a03be52b 100644 --- a/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs +++ b/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs @@ -39,6 +39,21 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s } + /// + /// Creates new instance of for a with NON-SECURED access. + /// + /// Database connection string + /// Database name + /// Collection name + /// Id expression + public MongoDbRepositorySettings(string connectionString, string databaseName, string collectionName, Expression> idExpression) + { + SetupSerialisationAndMapping(idExpression); + Client = GetClient(connectionString); + Database = GetDatabase(databaseName); + Collection = GetCollection(collectionName); + } + /// /// Creates new instance of for a with secured access. /// @@ -55,6 +70,7 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s Collection = GetCollection(collectionName); } + /// /// Initializes a new instance of the class for a /// with secured access. This constructor sets up the MongoDB diff --git a/src/data/src/repositories/MongoDb/RepositoryExtensions.cs b/src/data/src/repositories/MongoDb/RepositoryExtensions.cs index 75c198bc7..a9a284596 100644 --- a/src/data/src/repositories/MongoDb/RepositoryExtensions.cs +++ b/src/data/src/repositories/MongoDb/RepositoryExtensions.cs @@ -7,26 +7,26 @@ namespace AXOpen.Data.MongoDb { public static class Repository { - private static string MongoConnectionString { get; set; } - private static string MongoDatabaseName { get; set; } - private static MongoDbCredentials Credentials { get; set; } + //private static string MongoConnectionString { get; set; } + //private static string MongoDatabaseName { get; set; } + //private static MongoDbCredentials Credentials { get; set; } - /// - /// Initializes the MongoDB repository factory with default connection settings. - /// - /// The MongoDB connection string. - /// The name of the MongoDB database. - /// The username for database access. - /// The password for database access. - public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017", - string mongoDatabaseName = "AxOpenData", - string user = "user", - string userpw = "userpwd") - { - MongoConnectionString = mongoConnectionString; - MongoDatabaseName = mongoDatabaseName; - Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw); - } + ///// + ///// Initializes the MongoDB repository factory with default connection settings. + ///// + ///// The MongoDB connection string. + ///// The name of the MongoDB database. + ///// The username for database access. + ///// The password for database access. + //public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017", + // string mongoDatabaseName = "AxOpenData", + // string user = "user", + // string userpw = "userpwd") + //{ + // MongoConnectionString = mongoConnectionString; + // MongoDatabaseName = mongoDatabaseName; + // Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw); + //} /// /// Creates a repository for a specific type using the provided repository settings. @@ -47,57 +47,57 @@ public static IRepository Factory(this MongoDbRepositorySettings parame } } - /// - /// Creates a repository for a specific type and collection name. - /// - /// The type of the data object for the repository. - /// The name of the MongoDB collection. - /// An instance of . - /// Thrown when repository creation fails. - public static IRepository Factory(string collectionName) where T : IBrowsableDataObject - { - try - { - var settings = new MongoDbRepositorySettings( - connectionString: MongoConnectionString, - databaseName: MongoDatabaseName, - collectionName: collectionName, - credentials: Credentials); + ///// + ///// Creates a repository for a specific type and collection name. + ///// + ///// The type of the data object for the repository. + ///// The name of the MongoDB collection. + ///// An instance of . + ///// Thrown when repository creation fails. + //public static IRepository Factory(string collectionName) where T : IBrowsableDataObject + //{ + // try + // { + // var settings = new MongoDbRepositorySettings( + // connectionString: MongoConnectionString, + // databaseName: MongoDatabaseName, + // collectionName: collectionName, + // credentials: Credentials); - return new MongoDbRepository(settings); - } - catch (Exception ex) - { - throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex); - } - } + // return new MongoDbRepository(settings); + // } + // catch (Exception ex) + // { + // throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex); + // } + //} - /// - /// Creates a repository for a specific type, collection name, and ID expression. - /// - /// The type of the data object for the repository. - /// The name of the MongoDB collection. - /// An expression defining the property to use as the MongoDB '_id'. - /// An instance of . - /// Thrown when repository creation fails. - public static IRepository Factory(string collectionName,Expression> idExpression) where T : IBrowsableDataObject - { - try - { - var settings = new MongoDbRepositorySettings( - connectionString: MongoConnectionString, - databaseName: MongoDatabaseName, - collectionName: collectionName, - credentials: Credentials, - idExpression : idExpression - ); + ///// + ///// Creates a repository for a specific type, collection name, and ID expression. + ///// + ///// The type of the data object for the repository. + ///// The name of the MongoDB collection. + ///// An expression defining the property to use as the MongoDB '_id'. + ///// An instance of . + ///// Thrown when repository creation fails. + //public static IRepository Factory(MongoDbRepositorySettings settings, Expression> idExpression) where T : IBrowsableDataObject + //{ + // try + // { + // var settings = new MongoDbRepositorySettings( + // connectionString: MongoConnectionString, + // databaseName: MongoDatabaseName, + // collectionName: collectionName, + // credentials: Credentials, + // idExpression: idExpression + // ); - return new MongoDbRepository(settings); - } - catch (Exception ex) - { - throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex); - } - } + // return new MongoDbRepository(settings); + // } + // catch (Exception ex) + // { + // throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex); + // } + //} } } diff --git a/src/data/this.sln b/src/data/this.sln index 364e58f24..d9659560c 100644 --- a/src/data/this.sln +++ b/src/data/this.sln @@ -41,9 +41,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_repository_integrati EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_ax_sdk", "..\sdk-ax\ctrl\ix\ix_ax_ax_sdk.csproj", "{5DA36EFB-55C4-4386-AD4C-99AC7783E12E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\Security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_simatic1500", "..\simatic1500\ctrl\ix\ix_ax_axopen_simatic1500.csproj", "{74C7FC26-1CFB-45AF-BF08-296531C7AFAD}" EndProject @@ -123,13 +123,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ctrl", "..\sdk-ax\ctrl", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk-ax", "..\sdk-ax", "{EC2CC8A1-A290-4331-8418-01B4589134A7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\Security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\Security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Security", "..\Security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "..\security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ix", "..\simatic1500\ctrl\ix", "{6FF72005-D3B5-4BD6-8412-E13F37F67D54}" EndProject diff --git a/src/templates.simple/ax/src/BaseUnit/Unit.st b/src/templates.simple/ax/src/BaseUnit/Unit.st index 28ce26190..5783d027e 100644 --- a/src/templates.simple/ax/src/BaseUnit/Unit.st +++ b/src/templates.simple/ax/src/BaseUnit/Unit.st @@ -8,7 +8,7 @@ NAMESPACE axosimple.BaseUnit /// Represents controlled units and high level task coordination. /// {S7.extern=ReadWrite} - CLASS PUBLIC Unit + CLASS PUBLIC UnitBase EXTENDS AXOpen.Core.AxoObject IMPLEMENTS axosimple.IUnit VAR PUBLIC 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/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/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/Unit.st b/src/templates.simple/ax/src/templates/starterunit/Unit.st index 26337fe6c..df2d9f030 100644 --- a/src/templates.simple/ax/src/templates/starterunit/Unit.st +++ b/src/templates.simple/ax/src/templates/starterunit/Unit.st @@ -9,7 +9,7 @@ NAMESPACE axosimple.StarterUnitTemplate /// {S7.extern=ReadWrite} CLASS Unit - EXTENDS axosimple.BaseUnit.Unit + EXTENDS axosimple.BaseUnit.UnitBase VAR PUBLIC /// /// Provide access to unit objets, that are used into sequnces. 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..87fd18f9d 100644 --- a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor +++ b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor @@ -1,10 +1,13 @@ -@page "/Context/Units/StarterUnitTemplate" +@page "/Context/StarterUnitTemplate" @using AXOpen.Base.Dialogs; @using AXOpen.ToolBox.Extensions -@using axosimple.server.Components; @using AXOpen.VisualComposer; @using AXSharp.Connector; @using AXOpen.Core; +@using axosimple.server.Units +@using axosimple.StarterUnitTemplate +@using Context = axosimple.Context +@using Unit = axosimple.server.Components.Unit @inject IAlertService _alerts @inherits RenderableComplexComponentBase @@ -38,18 +41,11 @@
- - - + + @code { - private axosimple.UnitTemplate.Unit Unit => Entry.Plc.Context.UnitTemplate; + private UnitServices Services => Entry.Plc.Context.StarterUnitTemplate.Services; + private axosimple.StarterUnitTemplate.Unit Unit => Entry.Plc.Context.StarterUnitTemplate; } \ 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..3c0cb0d97 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,66 @@ using AXOpen.Base.Data; -using axosimple; +using AXOpen.Data.MongoDb; +using AXOpen.Messaging.Static; +using axosimple.server.Units; +using AXSharp.Connector; -namespace axosimple.server.Units + +namespace axosimple.StarterUnitTemplate { - public class StarterUnitTemplateServices + public partial class Unit + { + public UnitServices Services { get; } + } + + public class UnitServices : IUnitServices { - private StarterUnitTemplateServices(ContextService contextService) + private UnitServices(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; - private StarterUnitTemplate.Unit Unit { get; } = Entry.Plc.Context.StarterUnitTemplate; + 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; + } + } + + public axosimple.BaseUnit.UnitBase Unit { get; } = Entry.Plc.Context.StarterUnitTemplate; // Technology Data manager of unit private StarterUnitTemplate.TechnologyDataManager StarterUnitTechnologyDataManager { get; } = @@ -25,35 +75,64 @@ private StarterUnitTemplateServices(ContextService contextService) /// /// repository - settings connected with technology not with procuction process /// - public IRepository TechnologySettingsRepository { get; private set; } + public IRepository TechnologySettingsRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory( + new MongoDbRepositorySettings( + ContextService.DataBaseConnectionString, ContextService.DataBaseName, "StarterUnitTemplate_TechnologySettings")); /// /// repository - settings connected with specific recepie /// - public IRepository ProcessSettingsRepository { get; private set; } + public IRepository ProcessSettingsRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory( + new MongoDbRepositorySettings(ContextService.DataBaseConnectionString, ContextService.DataBaseName, "StarterUnitTemplate_ProcessSettings")); /// /// repository - data connected with specific part or piece in production/technology /// - public IRepository ProcessDataRepository { get; private set; } - - - public static StarterUnitTemplateServices Create(ContextService contextService) + public IRepository ProcessDataRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings(ContextService.DataBaseConnectionString, ContextService.DataBaseName, "StarterUnitTemplate_ProcessData")); + + + public static UnitServices Create(ContextService contextService) { - var retVal = new StarterUnitTemplateServices(contextService); + var retVal = new UnitServices(contextService); + retVal.Unit.UnitServices = retVal; + retVal.SetUnitsData(); return retVal; } - public void SetUnitsData( - IRepository technologySettingsRepository, - IRepository processSettingsRepository, - IRepository processDataRepository - ) - { - TechnologySettingsRepository = technologySettingsRepository; - ProcessSettingsRepository = processSettingsRepository; - ProcessDataRepository = processDataRepository; + // public StarterUnitTemplateServices SetUnitsData( + // IRepository technologySettingsRepository, + // IRepository processSettingsRepository, + // IRepository processDataRepository + // ) + // { + // TechnologySettingsRepository = technologySettingsRepository; + // ProcessSettingsRepository = processSettingsRepository; + // ProcessDataRepository = processDataRepository; + // + // // initialize partial repositories in global context + // _contextService.TechnologySettings.StarterUnitTemplate.InitializeRemoteDataExchange(TechnologySettingsRepository); + // _contextService.ProcessSettings.StarterUnitTemplate.InitializeRemoteDataExchange(ProcessSettingsRepository); + // _contextService.ProcessData.StarterUnitTemplate.InitializeRemoteDataExchange(ProcessDataRepository); + // + // // initialize unit process data manager + // StarterUnitProcessDataManager.Shared.InitializeRemoteDataExchange(_contextService.EntityDataRepository); + // StarterUnitProcessDataManager.DataManger.InitializeRemoteDataExchange(ProcessDataRepository); + // StarterUnitProcessDataManager.InitializeRemoteDataExchange(); + // + // // initialize unit technology data manager + // StarterUnitTechnologyDataManager.Shared.InitializeRemoteDataExchange(_contextService.TechnologyCommonRepository); + // StarterUnitTechnologyDataManager.DataManger.InitializeRemoteDataExchange(TechnologySettingsRepository); + // StarterUnitTechnologyDataManager.InitializeRemoteDataExchange(); + // + // return this; + // + // } + private UnitServices SetUnitsData() + { // initialize partial repositories in global context _contextService.TechnologySettings.StarterUnitTemplate.InitializeRemoteDataExchange(TechnologySettingsRepository); _contextService.ProcessSettings.StarterUnitTemplate.InitializeRemoteDataExchange(ProcessSettingsRepository); @@ -68,7 +147,13 @@ public void SetUnitsData( StarterUnitTechnologyDataManager.Shared.InitializeRemoteDataExchange(_contextService.TechnologyCommonRepository); StarterUnitTechnologyDataManager.DataManger.InitializeRemoteDataExchange(TechnologySettingsRepository); StarterUnitTechnologyDataManager.InitializeRemoteDataExchange(); - + + return this; + } + + public string Link => "Context/StarterUnitTemplate"; + + public string ImageLink => "logo-header.svg"; } } diff --git a/src/templates.simple/ax/src/templates/unit/AutomatSequence.st b/src/templates.simple/ax/src/templates/unit/AutomatSequence.st index 0583b535c..59e132654 100644 --- a/src/templates.simple/ax/src/templates/unit/AutomatSequence.st +++ b/src/templates.simple/ax/src/templates/unit/AutomatSequence.st @@ -78,14 +78,15 @@ NAMESPACE axosimple.UnitTemplate IF (Steps[10].Execute(THIS, TRUE, '<#GET DATA#>')) THEN //------------------------------------------------------- - // IF(ProcessSettings^.Read('MODEL_S').IsDone()) THEN - // THIS.ProcessData^.DataManger.Payload := ProcessSettings^.Payload; + // IF(ProcessSettingsManager^.Read('MODEL_S').IsDone()) THEN + // ProcessDataManager^.DataManger.Payload := ProcessSettingsManager^.Payload; // THIS.MoveNext(); // END_IF; IF (ProcessDataManager^.CreateOrUpdate(_currentId).IsDone()) THEN THIS.MoveNext(); END_IF; + //------------------------------------------------------- END_IF; diff --git a/src/templates.simple/ax/src/templates/unit/Unit.st b/src/templates.simple/ax/src/templates/unit/Unit.st index 54d38ae60..e47efdfdc 100644 --- a/src/templates.simple/ax/src/templates/unit/Unit.st +++ b/src/templates.simple/ax/src/templates/unit/Unit.st @@ -9,7 +9,7 @@ NAMESPACE axosimple.UnitTemplate /// {S7.extern=ReadWrite} CLASS Unit - EXTENDS axosimple.BaseUnit.Unit + EXTENDS axosimple.BaseUnit.UnitBase VAR PUBLIC /// /// Provide access to unit objets, that are used into sequnces. 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..e1bcfdee4 100644 --- a/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor +++ b/src/templates.simple/ax/src/templates/unit/server/UnitTemplate.razor @@ -1,10 +1,12 @@ -@page "/Context/Units/UnitTemplate" +@page "/Context/UnitTemplate" @using AXOpen.Base.Dialogs; @using AXOpen.ToolBox.Extensions -@using axosimple.server.Components; @using AXOpen.VisualComposer; @using AXSharp.Connector; @using AXOpen.Core; +@using axosimple.server.Units +@using axosimple.UnitTemplate +@using Unit = axosimple.server.Components.Unit @inject IAlertService _alerts @inherits RenderableComplexComponentBase @@ -36,17 +38,11 @@
- - + + @code { + private UnitServices Services => Entry.Plc.Context.UnitTemplate.Services; private axosimple.UnitTemplate.Unit Unit => Entry.Plc.Context.UnitTemplate; } 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..b7d49ec53 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,66 @@ using AXOpen.Base.Data; -using axosimple; +using AXOpen.Data.MongoDb; +using AXOpen.Messaging.Static; +using axosimple.server.Units; +using AXSharp.Connector; -namespace axosimple.server.Units +namespace axosimple.UnitTemplate { - public class UnitTemplateServices + public partial class Unit { - private UnitTemplateServices(ContextService contextService) + public UnitServices Services { get; } + } + + public class UnitServices : IUnitServices + { + private UnitServices(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.UnitBase Unit { get; } = Entry.Plc.Context.UnitTemplate; // Technology Data manager of unit private UnitTemplate.TechnologyDataManager UnitTechnologyDataManager { get; } = @@ -22,38 +72,38 @@ private UnitTemplateServices(ContextService contextService) private ContextService _contextService { get; } - /// + /// /// repository - settings connected with technology not with procuction process /// - public IRepository TechnologySettingsRepository { get; private set; } + public IRepository TechnologySettingsRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory( + new MongoDbRepositorySettings(ContextService.DataBaseConnectionString, ContextService.DataBaseName, "UnitTemplate_TechnologySettings")); /// /// repository - settings connected with specific recepie /// - public IRepository ProcessSettingsRepository { get; private set; } + public IRepository ProcessSettingsRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory( + new MongoDbRepositorySettings(ContextService.DataBaseConnectionString, ContextService.DataBaseName, "UnitTemplate_ProcessSettings")); /// /// repository - data connected with specific part or piece in production/technology /// - public IRepository ProcessDataRepository { get; private set; } + public IRepository ProcessDataRepository { get; } + = AXOpen.Data.MongoDb.Repository.Factory( + new MongoDbRepositorySettings(ContextService.DataBaseConnectionString, ContextService.DataBaseName, "UnitTemplate_ProcessData")); - public static UnitTemplateServices Create(ContextService contextService) + public static UnitServices Create(ContextService contextService) { - var retVal = new UnitTemplateServices(contextService); + var retVal = new UnitServices(contextService); + retVal.Unit.UnitServices = retVal; + retVal.SetUnitsData(); return retVal; } - public void SetUnitsData( - IRepository technologySettingsRepository, - IRepository processSettingsRepository, - IRepository processDataRepository - ) + private void SetUnitsData() { - TechnologySettingsRepository = technologySettingsRepository; - ProcessSettingsRepository = processSettingsRepository; - ProcessDataRepository = processDataRepository; - // initialize partial repositories in global context _contextService.TechnologySettings.UnitTemplate.InitializeRemoteDataExchange(TechnologySettingsRepository); _contextService.ProcessSettings.UnitTemplate.InitializeRemoteDataExchange(ProcessSettingsRepository); @@ -68,7 +118,10 @@ public void SetUnitsData( UnitTechnologyDataManager.Shared.InitializeRemoteDataExchange(_contextService.TechnologyCommonRepository); UnitTechnologyDataManager.DataManger.InitializeRemoteDataExchange(TechnologySettingsRepository); UnitTechnologyDataManager.InitializeRemoteDataExchange(); - } + + public string Link => "Context/UnitTemplate"; + + public string ImageLink => "logo-axopen-no-background.svg"; } } 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/AlarmsButton.razor b/src/templates.simple/axpansion/server/Components/AlarmsButton.razor index 5634b763a..bd20ad18e 100644 --- a/src/templates.simple/axpansion/server/Components/AlarmsButton.razor +++ b/src/templates.simple/axpansion/server/Components/AlarmsButton.razor @@ -53,4 +53,5 @@ else if (Observer != null) await Observer.InitializeUpdate(); await base.OnInitializedAsync(); } + } diff --git a/src/templates.simple/axpansion/server/Components/AlarmsIndicator.razor b/src/templates.simple/axpansion/server/Components/AlarmsIndicator.razor new file mode 100644 index 000000000..728d64469 --- /dev/null +++ b/src/templates.simple/axpansion/server/Components/AlarmsIndicator.razor @@ -0,0 +1,48 @@ +@namespace AXOpen.Core +@using AXOpen.Messaging.Static +@using AXOpen.Messaging.Static.Blazor +@using AXSharp.Connector +@inherits RenderableComplexComponentBase + + +@if(MessageProvider?.ActiveMessagesCount > 0) +{ + + @MessageProvider?.ActiveMessagesCount + unread messages + +} + + +@code { + private AxoMessageObserver? observer; + + [Parameter] + public AxoMessageProvider? MessageProvider { get; set; } + + private AxoMessageObserver? Observer + { + get + { + if (observer == null && MessageProvider != null) + observer = AxoMessageObserver.Create(MessageProvider, this); + + return observer; + } + } + + private string Disabled => MessageProvider?.ActiveMessagesCount> 0 ? "false" : "true"; + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await base.OnAfterRenderAsync(firstRender); + this.StateHasChanged(); + } + + protected override async Task OnInitializedAsync() + { + if (Observer != null) await Observer.InitializeUpdate(); + await base.OnInitializedAsync(); + } + +} diff --git a/src/templates.simple/axpansion/server/Components/Unit.razor b/src/templates.simple/axpansion/server/Components/Unit.razor index dbeec626d..ad3aa4d5f 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 RenderableComplexComponentBase
@*
*@ @* *@ @*
*@ - - + +
@@ -24,15 +25,15 @@