From 62c8e7a56547ca225343ef11a47749f676955074 Mon Sep 17 00:00:00 2001 From: IX-BOT <137874481+IX-BOT@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:44:58 +0100 Subject: [PATCH 01/11] Create draft PR for #466 From 240e9a9d6f2f97eb1858e64ba204e6e94379c9e4 Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Tue, 10 Dec 2024 10:04:43 +0100 Subject: [PATCH 02/11] dataexchange user action loging --- .../AxoDataExchange/DataExchangeViewModel.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeViewModel.cs b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeViewModel.cs index 7a9831b9e..cf03be4c9 100644 --- a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeViewModel.cs +++ b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeViewModel.cs @@ -210,7 +210,7 @@ public async Task CreateNew() } await DataExchange.CreateNewAsync(CreateItemId); - AxoApplication.Current.Logger.Information($"Create {CreateItemId} in {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + AxoApplication.Current.Logger.Information($"Created {CreateItemId} in {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); AlertDialogService?.AddAlertDialog(eAlertType.Success, "Created!", "Item was successfully created!", 10); } catch (Exception e) @@ -232,7 +232,7 @@ public async void Delete() try { await DataExchange.Delete(SelectedRecord.DataEntityId); - AxoApplication.Current.Logger.Information($"Delete {SelectedRecord.DataEntityId} in {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + AxoApplication.Current.Logger.Information($"Deleted {SelectedRecord.DataEntityId} from {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); AlertDialogService?.AddAlertDialog(eAlertType.Success, "Deleted!", "Item was successfully deleted!", 10); } catch (Exception e) @@ -253,7 +253,7 @@ public async Task Copy() try { await DataExchange.CreateCopyCurrentShadowsAsync(CreateItemId); - AxoApplication.Current.Logger.Information($"Copy {CreateItemId} in {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + AxoApplication.Current.Logger.Information($"Copied {CreateItemId} into {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); AlertDialogService.AddAlertDialog(eAlertType.Success, "Copied!", "Item was successfully copied!", 10); } catch (Exception e) @@ -282,6 +282,7 @@ public async Task Edit() public async Task SendToPlc() { await DataExchange.FromRepositoryToControllerAsync(SelectedRecord); + AxoApplication.Current.Logger.Information($"Sended to Plc {SelectedRecord.DataEntityId} in {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); AlertDialogService?.AddAlertDialog(eAlertType.Success, "Sended to PLC!", "Item was successfully sended to PLC!", 10); } @@ -291,6 +292,8 @@ public async Task LoadFromPlc() { await DataExchange.CreateDataFromControllerAsync(CreateItemId); AlertDialogService?.AddAlertDialog(eAlertType.Success, "Loaded from PLC!", "Item was successfully loaded from PLC!", 10); + AxoApplication.Current.Logger.Information($"Loaded from Plc {CreateItemId} into {DataExchange} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + } catch (Exception e) { @@ -318,6 +321,9 @@ public Task ExportDataAsync(string path) IsFileExported = true; AlertDialogService?.AddAlertDialog(eAlertType.Success, "Exported!", "Data was successfully exported!", 10); + + AxoApplication.Current.Logger.Information($"Exported data from {DataExchange} to path {path} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + } catch (Exception e) { @@ -337,6 +343,8 @@ public Task ImportDataAsync(string path) this.UpdateObservableRecords(); AlertDialogService?.AddAlertDialog(eAlertType.Success, "Imported!", "Data was successfully imported!", 10); + AxoApplication.Current.Logger.Information($"Imported data into {DataExchange} from path {path} by user action.", AuthenticationProvider.GetAuthenticationStateAsync().Result.User.Identity); + } catch (Exception e) { From b62822fe8bc4b9048a2e1fb8f872dd37ab93bbb2 Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Tue, 10 Dec 2024 12:48:25 +0100 Subject: [PATCH 03/11] Double akc on button send data to PLC --- .../AxoDataExchange/DataExchangeView.razor | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor index 74486369b..aa3cb9195 100644 --- a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor +++ b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor @@ -247,7 +247,10 @@ else
- + + + +
} @@ -335,7 +338,9 @@ else - + + + } @@ -471,6 +476,23 @@ else + + + @@ -485,13 +573,30 @@ else + + diff --git a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor.cs b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor.cs index ea02910d8..b0b482860 100644 --- a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor.cs +++ b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor.cs @@ -8,7 +8,9 @@ using AXOpen.Base.Data; using AXOpen.Data.Interfaces; using AXOpen.Data; + using AXOpen.Data.Interfaces; + using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using System.IO; @@ -16,14 +18,18 @@ using AXOpen.Base.Dialogs; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using static AXOpen.Data.DataExchangeViewModel; + using AXOpen.Data; + using AXSharp.Connector; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Messaging; + using Microsoft.AspNetCore.Components.Forms; using AXOpen.Data.Interfaces; using AXOpen.Core; using AXOpen.Data; + using System.Data.Common; namespace AXOpen.Data; @@ -177,9 +183,27 @@ public async Task LoadCustomExportDataAsync() StateHasChanged(); } + protected void ReloadRecordAfterEditWithoutModal() + { + if (this.ModalDataView) return; // make a sense when is not modal window + + string identifier = Vm.SelectedRecord.DataEntityId; + + Vm.FillObservableRecordsAsync().GetAwaiter(); + + var rec = Vm.Records.Where(e => e.DataEntityId == identifier).First(); + + if (rec != null) + { + Vm.SelectedRecord = rec; + + this.StateHasChanged(); + } + } + public void Dispose() { - if(Vm.IsLockedByMeOrNull()) + if (Vm.IsLockedByMeOrNull()) Vm.DataExchange.SetLockedBy(null); } } \ No newline at end of file From 7623ecf484837dbbc34809ea01a9c433e29c3627 Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Wed, 11 Dec 2024 06:19:03 +0100 Subject: [PATCH 06/11] fix refactored method in dataexchange --- .../AxoDataExchange/DataExchangeView.razor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor index 3f775dd77..700e88810 100644 --- a/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor +++ b/src/data/src/AXOpen.Data.Blazor/AxoDataExchange/DataExchangeView.razor @@ -491,7 +491,7 @@ else @@ -585,13 +585,13 @@ else From bbd2640f746904c246b3f4a7157d497503967e8e Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Wed, 11 Dec 2024 06:43:59 +0100 Subject: [PATCH 07/11] update upax file for app, entry, certs --- .../SystemConstants/plc_line_HwIdentifiers.st | 19 +++++++++++++ .../SystemConstants/plc_line_IoAddresses.st | 5 ++++ src/data/app/apax.yml | 6 +++- src/data/app/ix/Entry.cs | 28 ++++++++++++++++--- src/data/app/ix/axopen_data_app.csproj | 6 ++++ src/data/app/src/IO/HwIdentifiers.st | 23 +++++++++++++++ src/data/app/src/IO/Inputs.st | 9 ++++++ src/data/app/src/IO/Outputs.st | 9 ++++++ 8 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 src/data/app/SystemConstants/plc_line_HwIdentifiers.st create mode 100644 src/data/app/SystemConstants/plc_line_IoAddresses.st create mode 100644 src/data/app/src/IO/HwIdentifiers.st create mode 100644 src/data/app/src/IO/Inputs.st create mode 100644 src/data/app/src/IO/Outputs.st diff --git a/src/data/app/SystemConstants/plc_line_HwIdentifiers.st b/src/data/app/SystemConstants/plc_line_HwIdentifiers.st new file mode 100644 index 000000000..5631dc14d --- /dev/null +++ b/src/data/app/SystemConstants/plc_line_HwIdentifiers.st @@ -0,0 +1,19 @@ +CONFIGURATION HardwareIDs + VAR_GLOBAL CONSTANT + plc_line_HwID : UINT := UINT#32; + plc_line_Rail_0_HwID : UINT := UINT#257; + plc_line_plc_line_HwID : UINT := UINT#48; + plc_line_plc_line_CPU_display_1_HwID : UINT := UINT#54; + plc_line_plc_line_Card_reader_writer_1_HwID : UINT := UINT#51; + plc_line_plc_line_DP_interface_1_HwID : UINT := UINT#60; + plc_line_plc_line_OPC_UA_1_HwID : UINT := UINT#117; + plc_line_plc_line_profinet_x1_HwID : UINT := UINT#64; + plc_line_plc_line_profinet_x1_Port_1_HwID : UINT := UINT#65; + plc_line_plc_line_profinet_x1_Port_2_HwID : UINT := UINT#66; + plc_line_plc_line_profinet_x2_HwID : UINT := UINT#72; + plc_line_plc_line_profinet_x2_Port_3_HwID : UINT := UINT#73; + plc_line_plc_line_virtual_communication_interface_HwID : UINT := UINT#135; + profinet_plc_line_HwID : UINT := UINT#256; + + END_VAR +END_CONFIGURATION diff --git a/src/data/app/SystemConstants/plc_line_IoAddresses.st b/src/data/app/SystemConstants/plc_line_IoAddresses.st new file mode 100644 index 000000000..1f46b8a7a --- /dev/null +++ b/src/data/app/SystemConstants/plc_line_IoAddresses.st @@ -0,0 +1,5 @@ +CONFIGURATION IoAddresses + VAR_GLOBAL + + END_VAR +END_CONFIGURATION diff --git a/src/data/app/apax.yml b/src/data/app/apax.yml index 2d8ab579d..da7603ced 100644 --- a/src/data/app/apax.yml +++ b/src/data/app/apax.yml @@ -14,7 +14,11 @@ dependencies: "@ix-ax/axopen.data": '0.0.0-dev.0' "@ix-ax/ax.axopen.app": '0.0.0-dev.0' "@ix-ax/axopen.simatic1500": '0.0.0-dev.0' -installStrategy: strict + # this is just temporary to test new features + # upto the moment of releasing new catalog + # installStrategy: strict + "@ix-ax/ax.latest.packages": '0.0.0-dev.0' +installStrategy: overridable apaxVersion: 3.3.1 scripts: # For proper execution of these scripts, the following variables need to be defined as environment variables or local variables. diff --git a/src/data/app/ix/Entry.cs b/src/data/app/ix/Entry.cs index 0d7959358..05abd8a94 100644 --- a/src/data/app/ix/Entry.cs +++ b/src/data/app/ix/Entry.cs @@ -5,18 +5,38 @@ using System.Text; using System.Threading.Tasks; using AXSharp.Connector.S71500.WebApi; +using System.Net.Security; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; namespace librarytemplate { + public static class Entry { - private static readonly string TargetIp = Environment.GetEnvironmentVariable("AXTARGET"); // <- replace by your IP - private const string UserName = "Everybody"; //<- replace by user name you have set up in your WebAPI settings - private const string Pass = ""; // <- Pass in the password that you have set up for the user. NOT AS PLAIN TEXT! Use user secrets instead. + public static string TargetIp { get; } = Environment.GetEnvironmentVariable("AXTARGET"); // <- replace by your IP + private static string Pass => Environment.GetEnvironmentVariable("AX_TARGET_PWD"); // <- Pass in the password that you have set up for the user. NOT AS PLAIN TEXT! Use user secrets instead. + private static string UserName = Environment.GetEnvironmentVariable("AX_USERNAME"); //<- replace by user name you have set up in your WebAPI settings private const bool IgnoreSslErrors = true; // <- When you have your certificates in order set this to false. + private static string CertificatePath = "certs\\plc_line\\plc_line.cer"; + + static string GetCertPath() + { + var fp = new FileInfo(Path.Combine(Assembly.GetExecutingAssembly().Location)); + return Path.Combine(fp.DirectoryName, CertificatePath); + } + + static readonly X509Certificate2 Certificate = new X509Certificate2(GetCertPath()); + + private static bool CertificateValidation(HttpRequestMessage requestMessage, X509Certificate2 certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return certificate.Thumbprint == Certificate.Thumbprint; + } public static axopen_data_appTwinController Plc { get; } = new(ConnectorAdapterBuilder.Build() - .CreateWebApi(TargetIp, UserName, Pass, IgnoreSslErrors)); + .CreateWebApi(TargetIp, UserName, Pass, CertificateValidation, IgnoreSslErrors)); + } + } \ No newline at end of file diff --git a/src/data/app/ix/axopen_data_app.csproj b/src/data/app/ix/axopen_data_app.csproj index 840a074e4..04ff00109 100644 --- a/src/data/app/ix/axopen_data_app.csproj +++ b/src/data/app/ix/axopen_data_app.csproj @@ -20,6 +20,12 @@ + + + Always + + + diff --git a/src/data/app/src/IO/HwIdentifiers.st b/src/data/app/src/IO/HwIdentifiers.st new file mode 100644 index 000000000..3ceda4158 --- /dev/null +++ b/src/data/app/src/IO/HwIdentifiers.st @@ -0,0 +1,23 @@ +NAMESPACE AXOpen.Data + TYPE + HwIdentifiers : WORD + ( + plc_line_HwID := WORD#32, + plc_line_Rail_0_HwID := WORD#257, + plc_line_plc_line_HwID := WORD#48, + plc_line_plc_line_CPU_display_1_HwID := WORD#54, + plc_line_plc_line_Card_reader_writer_1_HwID := WORD#51, + plc_line_plc_line_DP_interface_1_HwID := WORD#60, + plc_line_plc_line_OPC_UA_1_HwID := WORD#117, + plc_line_plc_line_profinet_x1_HwID := WORD#64, + plc_line_plc_line_profinet_x1_Port_1_HwID := WORD#65, + plc_line_plc_line_profinet_x1_Port_2_HwID := WORD#66, + plc_line_plc_line_profinet_x2_HwID := WORD#72, + plc_line_plc_line_profinet_x2_Port_3_HwID := WORD#73, + plc_line_plc_line_virtual_communication_interface_HwID := WORD#135, + profinet_plc_line_HwID := WORD#256, + + NONE := WORD#0 + ); + END_TYPE +END_NAMESPACE diff --git a/src/data/app/src/IO/Inputs.st b/src/data/app/src/IO/Inputs.st new file mode 100644 index 000000000..ffad6a760 --- /dev/null +++ b/src/data/app/src/IO/Inputs.st @@ -0,0 +1,9 @@ +NAMESPACE AXOpen.Data + TYPE + {S7.extern=ReadWrite} + {#ix-attr:[Container(Layout.Wrap)]} + Inputs : STRUCT + noInputsFoundInTheHwConfig AT %B0: BYTE; + END_STRUCT; + END_TYPE +END_NAMESPACE diff --git a/src/data/app/src/IO/Outputs.st b/src/data/app/src/IO/Outputs.st new file mode 100644 index 000000000..d70d84cda --- /dev/null +++ b/src/data/app/src/IO/Outputs.st @@ -0,0 +1,9 @@ +NAMESPACE AXOpen.Data + TYPE + {S7.extern=ReadWrite} + {#ix-attr:[Container(Layout.Wrap)]} + Outputs : STRUCT + noOutputsFoundInTheHwConfig AT %B0: BYTE; + END_STRUCT; + END_TYPE +END_NAMESPACE From 2a80e99cfcf66685e15c622b92aa732ceb66a6d0 Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Wed, 11 Dec 2024 09:15:56 +0100 Subject: [PATCH 08/11] certs --- src/data/app/ix/Entry.cs | 1 + src/data/app/ix/axopen_data_app.csproj | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/data/app/ix/Entry.cs b/src/data/app/ix/Entry.cs index 05abd8a94..64e9c9e65 100644 --- a/src/data/app/ix/Entry.cs +++ b/src/data/app/ix/Entry.cs @@ -37,6 +37,7 @@ private static bool CertificateValidation(HttpRequestMessage requestMessage, X50 = new(ConnectorAdapterBuilder.Build() .CreateWebApi(TargetIp, UserName, Pass, CertificateValidation, IgnoreSslErrors)); + } } \ No newline at end of file diff --git a/src/data/app/ix/axopen_data_app.csproj b/src/data/app/ix/axopen_data_app.csproj index 04ff00109..778a11cb2 100644 --- a/src/data/app/ix/axopen_data_app.csproj +++ b/src/data/app/ix/axopen_data_app.csproj @@ -18,12 +18,13 @@ + - - Always - + + PreserveNewest + From 84ad91f8d2c8320373b3b114fa389616e6e7a878 Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Wed, 11 Dec 2024 09:23:43 +0100 Subject: [PATCH 09/11] cert --- src/data/app/certs/plc_line/plc_line.cer | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/data/app/certs/plc_line/plc_line.cer diff --git a/src/data/app/certs/plc_line/plc_line.cer b/src/data/app/certs/plc_line/plc_line.cer new file mode 100644 index 000000000..02a0fb0c6 --- /dev/null +++ b/src/data/app/certs/plc_line/plc_line.cer @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDqTCCApGgAwIBAgIUWIyy2tceYfRUs4uPo6KZXlgGQY8wDQYJKoZIhvcNAQELBQAwgYYxCzAJ +BgNVBAYTAlhYMRIwEAYDVQQIDAlTdGF0ZU5hbWUxETAPBgNVBAcMCENpdHlOYW1lMRQwEgYDVQQK +DAtDb21wYW55TmFtZTEbMBkGA1UECwwSQ29tcGFueVNlY3Rpb25OYW1lMR0wGwYDVQQDDBRDb21t +b25OYW1lT3JIb3N0bmFtZTAeFw0yNDEyMTAxMDI3MTFaFw0yNTEyMTAxMDI3MTFaMIGGMQswCQYD +VQQGEwJYWDESMBAGA1UECAwJU3RhdGVOYW1lMREwDwYDVQQHDAhDaXR5TmFtZTEUMBIGA1UECgwL +Q29tcGFueU5hbWUxGzAZBgNVBAsMEkNvbXBhbnlTZWN0aW9uTmFtZTEdMBsGA1UEAwwUQ29tbW9u +TmFtZU9ySG9zdG5hbWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmr6liRyZbj0WO +0rxgaGmbR+RB/petCLZXE7zWjVbctSnVHSZOHpRR0MGcdl1Py9LmD4OCBLr227dZBn94E4xZLxFc +LiuIxfxoTLgRdt3mmdaZTdQ1cyhB/vMoYbPlwt1UXXKhZWpJl0k7kyrBE1eilGoBj5QzE/740cVJ +MWZ2TwGOSpzdTDGzCTKwUHiEUdgldslHzf+On5kwPVuYPxyvLF2AtJ3sJOg3Me3W6l39nDXkT2SQ +CcnGiELF0k06UNOS2q+r8mg8uOltNVBkdjnEoTWzMCRx+XHNfiliJPqK3hO6QHuZEP2UZA+6HRrk +jkhopEaaLOE528aVCXqgg+itAgMBAAGjDTALMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEB +AHzLOYXsUK0aTHtY2VZEg03MgvHrxI3lfCWQNo0/lhkedhxBkHF8/I9IHlZxaSTCElfKVnEsb9JW +JI6zK8UNLei2Sy6qwpHnePQZPkl9usaRn/AmgybEDUZk8vZ/RhAPgTvi8zGZTLU+oIvZ9gL46PUa +/b+YYgGtu2ax+OSz7ZUVqyGeL9mF7mNjGRP+i01qF6DeemhO1YCXw4zdK12z5t3qc/wKJkAdGTun +BF06KgzJIY6Q2jrrC6mtIQou7UdmPSkpWegLLYfk3gPMVbw5Na8puIM1EDE28fFNJb9VABs3prtp +gRfWVdYDCg9/agYD1kR4ZbJZeu6/+I5GUod5DUE= +-----END CERTIFICATE----- From 3b0a2b2d5c2df430a879517ef25d3436eb096c8a Mon Sep 17 00:00:00 2001 From: "blazej.kuhajda" Date: Wed, 11 Dec 2024 09:52:51 +0100 Subject: [PATCH 10/11] some change --- .../librarytemplate.blazor/Program.cs | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs index 524de6c69..8fe647554 100644 --- a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs +++ b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs @@ -1,22 +1,17 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using System.Data; -using AXOpen.Core; -using AxOpen.Security.Services; -using AXSharp.Presentation.Blazor.Services; -using AXSharp.Connector; -using AXOpen.Base.Data; -using AxOpen.Security.Entities; -using System.Reflection; using AxOpen.Security; -using Serilog; +using AxOpen.Security.Entities; +using AxOpen.Security.Services; using AXOpen; +using AXOpen.Base.Data; +using AXOpen.Data.Json; +using AXOpen.Data.MongoDb; using AXOpen.Logging; +using AXSharp.Connector; +using AXSharp.Presentation.Blazor.Services; using librarytemplate; -using AXOpen.Data.InMemory; -using AXOpen.Data.MongoDb; -using AXOpen.Data.Json; - +using Serilog; +using System.Data; +using System.Reflection; var builder = WebApplication.CreateBuilder(args); @@ -41,13 +36,13 @@ fileSizeLimitBytes: 100000) .MinimumLevel.Debug() .CreateLogger()); + await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync(); AxoApplication.CreateBuilder().ConfigureLogger(new SerilogLogger(new LoggerConfiguration() .WriteTo.Console().MinimumLevel.Verbose() .CreateLogger())); - // IRepository persistentRepository; @@ -60,17 +55,14 @@ // *** MONGO REPOSITORY *** - persistentRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "PersistentData")); - -Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange( - Entry.Plc.AxoDataPersistentContext.PersistentRootObject, +Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange( + Entry.Plc.AxoDataPersistentContext.PersistentRootObject, persistentRepository ); // - // IRepository SharedDataHeaderDataRepository; IRepository Station_1_DataRepository; @@ -97,7 +89,6 @@ AxoProcessDataManager.InitializeRemoteDataExchange(); // - // IRepository AxoProcessDataRepository; @@ -111,8 +102,7 @@ // *** MONGO REPOSITORY *** - -AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData","AxoDataExchangeExample")); +AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "AxoDataExchangeExample")); Entry.Plc.AxoDataExchangeContext.DataManager.InitializeRemoteDataExchange(AxoProcessDataRepository); // @@ -143,7 +133,6 @@ app.Run(); - static string CreateJsonRepositoryDirectory(string path = "..\\..\\..\\..\\..\\JSONREPOS\\") { var executingAssemblyFile = new FileInfo(Assembly.GetExecutingAssembly().Location); @@ -157,7 +146,6 @@ static string CreateJsonRepositoryDirectory(string path = "..\\..\\..\\..\\..\\J static (IRepository, IRepository) SetUpJsonSecurityRepository(string repositoryDirectory) { - IRepository userRepo = new JsonRepository(new JsonRepositorySettings(Path.Combine(repositoryDirectory, "Users"))); IRepository groupRepo = new JsonRepository(new JsonRepositorySettings(Path.Combine(repositoryDirectory, "Groups"))); @@ -178,10 +166,12 @@ public static List CreateRoles() new Role(can_skip_steps_in_sequence), }; - - foreach (var item in typeof(AXOpen.Data.DataExchangeRoleNames). - GetFields(BindingFlags.Public | BindingFlags.Static). - Where(f => f.FieldType == typeof(string))) + //roles.Add(new Role(AXOpen.Data.DataExchangeRoleNames.can_data_item_create)); + // ... + + foreach (var item in typeof(AXOpen.Data.DataExchangeRoleNames). + GetFields(BindingFlags.Public | BindingFlags.Static). + Where(f => f.FieldType == typeof(string))) { roles.Add(new Role(item.Name)); } @@ -189,12 +179,10 @@ public static List CreateRoles() return roles; } - - public const string can_run_ground_mode = nameof(can_run_ground_mode); public const string can_run_automat_mode = nameof(can_run_automat_mode); public const string can_run_service_mode = nameof(can_run_service_mode); 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 From daa5504174c5cc0f94701eda5d479729c881bc64 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:01:33 +0100 Subject: [PATCH 11/11] fixed an issue with dependency --- src/ax.axopen.hwlibrary/ctrl/apax.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ax.axopen.hwlibrary/ctrl/apax.yml b/src/ax.axopen.hwlibrary/ctrl/apax.yml index ae5098bd6..3c0063791 100644 --- a/src/ax.axopen.hwlibrary/ctrl/apax.yml +++ b/src/ax.axopen.hwlibrary/ctrl/apax.yml @@ -6,7 +6,7 @@ files: devDependencies: "@ix-ax/ax-sdk": '0.0.0-dev.0' catalogs: - "@ax/simatic-ax": ^2405.2.0 + "@ax/simatic-ax": 2405.2.0 dependencies: "@ix-ax/ax.axopen.min": '0.0.0-dev.0' "@ax/simatic-1500-distributedio": 7.0.1