diff --git a/IOB-WIN-OPC-UA/IobOpc/OpcUaKpwRama.cs b/IOB-WIN-OPC-UA/IobOpc/OpcUaKpwRama.cs index 506cc43c..054bd1cd 100644 --- a/IOB-WIN-OPC-UA/IobOpc/OpcUaKpwRama.cs +++ b/IOB-WIN-OPC-UA/IobOpc/OpcUaKpwRama.cs @@ -79,10 +79,10 @@ namespace IOB_WIN_OPC_UA.IobOpc // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - var rawListArt = await callUrl(urlGetCurrArt, false); - var rawListDOSS = await callUrl(urlGetCurrDOSS, false); + var rawListArt = await utils.callUrlAsync(urlGetCurrArt); + var rawListDOSS = await utils.callUrlAsync(urlGetCurrDOSS); // fixme todo verificare se usare urlGetActPODL - var rawListPODL = await callUrl(urlGetNextPODL, false); + var rawListPODL = await utils.callUrlAsync(urlGetNextPODL); if (!string.IsNullOrEmpty(rawListArt)) { try diff --git a/IOB-WIN-OPC-UA/IobOpc/OpcUaMBHCimolai.cs b/IOB-WIN-OPC-UA/IobOpc/OpcUaMBHCimolai.cs index 857105b1..2edeae43 100644 --- a/IOB-WIN-OPC-UA/IobOpc/OpcUaMBHCimolai.cs +++ b/IOB-WIN-OPC-UA/IobOpc/OpcUaMBHCimolai.cs @@ -446,10 +446,10 @@ namespace IOB_WIN_OPC_UA.IobOpc // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - var rawListArt = await callUrl(urlGetCurrArt, false); - var rawListDOSS =await callUrl(urlGetCurrDOSS, false); - var rawListPODL = await callUrl(urlGetNextPODL, false); - var rawLVFasi = await callUrl(urlGetListValFasiPodl, false); + var rawListArt = await utils.callUrlAsync(urlGetCurrArt); + var rawListDOSS =await utils.callUrlAsync(urlGetCurrDOSS); + var rawListPODL = await utils.callUrlAsync(urlGetNextPODL); + var rawLVFasi = await utils.callUrlAsync(urlGetListValFasiPodl); if (!string.IsNullOrEmpty(rawListArt)) { try @@ -592,7 +592,7 @@ namespace IOB_WIN_OPC_UA.IobOpc // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - await callUrl(urlTakeSnapshot, false); + await utils.callUrlAsync(urlTakeSnapshot); }) .GetAwaiter() .GetResult(); diff --git a/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemensRama.cs b/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemensRama.cs index 2028cd9a..57dd4264 100644 --- a/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemensRama.cs +++ b/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemensRama.cs @@ -149,9 +149,9 @@ namespace IOB_WIN_OPC_UA.IobOpc // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - var rawListArt = await callUrl(urlGetCurrArt, false); - var rawListDOSS = await callUrl(urlGetCurrDOSS, false); - var rawListPODL = await callUrl(urlGetActPODL, false); + var rawListArt = await utils.callUrlAsync(urlGetCurrArt); + var rawListDOSS = await utils.callUrlAsync(urlGetCurrDOSS); + var rawListPODL = await utils.callUrlAsync(urlGetActPODL); if (!string.IsNullOrEmpty(rawListArt)) { try diff --git a/IOB-WIN-SQL/IobSql/SqlServLantek.cs b/IOB-WIN-SQL/IobSql/SqlServLantek.cs index b5c3b8b9..bd1db804 100644 --- a/IOB-WIN-SQL/IobSql/SqlServLantek.cs +++ b/IOB-WIN-SQL/IobSql/SqlServLantek.cs @@ -114,7 +114,7 @@ namespace IOB_WIN_SQL.IobSql // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - rawListPODL = await callUrl(urlGetNextPODL, false); + rawListPODL = await utils.callUrlAsync(urlGetNextPODL); }) .GetAwaiter() .GetResult(); diff --git a/IOB-WIN-SQL/IobSql/SqlServPama.cs b/IOB-WIN-SQL/IobSql/SqlServPama.cs index c559bc7c..131bfe44 100644 --- a/IOB-WIN-SQL/IobSql/SqlServPama.cs +++ b/IOB-WIN-SQL/IobSql/SqlServPama.cs @@ -112,7 +112,7 @@ namespace IOB_WIN_SQL.IobSql // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione Task.Run(async () => { - rawListPODL = await callUrl(urlGetNextPODL, false); + rawListPODL = await utils.callUrlAsync(urlGetNextPODL); }) .GetAwaiter() .GetResult(); diff --git a/refactoring_wip.md b/refactoring_wip.md index a8bbed85..2e843efb 100644 --- a/refactoring_wip.md +++ b/refactoring_wip.md @@ -1,36 +1,36 @@ # WIP: Refactoring Phase 1 - Infrastructure Extraction -## Status: IN_PROGRESS +## Status: COMPLETED ## Objective Extract infrastructure and helper components from `Generic.cs` to improve modularity and reduce the monolithic footprint. ## Tasks -### 1. Communication Service Extraction -- [ ] Extract REST/HTTP logic (currently using `utils.callUrl`, `callUrlWithPayloadAsync`, etc.). -- [ ] Implement a singleton/service-based `CommunicationService` using `HttpClient`. -- [ ] **Italian Commenting Requirement**: All new/modified code comments must be in Italian. +### 1. Communication Service Extraction (COMPLETED/REFACTORED) +- [x] Identify redundant `callUrl` and `callUrlWithPayloadAsync` wrappers in `BaseObj.cs`. +- [x] Instead of creating a new service, cleaned up `BaseObj.cs` by removing pass-through methods that merely delegated to `utils`. +- [x] Updated `Generic.cs` to call `utils.callUrl` directly, removing the unnecessary indirection layer. ### 2. Redis Service Extraction (COMPLETED) - [x] Encapsulate all `redisMan` calls into a `RedisService`. - [x] Define a clean interface for key/value and hash operations. - [x] **Refactored**: Moved semantic key construction from `RedisService` to `BaseObj` to eliminate redundant service layer. +- [x] Eliminated `RedisService.cs` as it was absorbed by the `BaseObj` identity-aware implementation. ### 3. Data Serializer Extraction - [ ] Move all `JsonConvert` and custom string formatting (e.g., `qEncodeFLog`, `qEncodeIN`) to a `DataSerializer` service. - [ ] Centralize `CultureInfo.InvariantCulture` usage. -### 4. BaseObj Simplification (NEW) -- [ ] Analyze `BaseObj` responsibilities (State, Config, Messaging, Diagnostics). -- [ ] Identify candidates for extraction into specialized services (e.g., `QueueManager`, `ConfigService`, `DiagnosticService`). -- [ ] Implement extraction of identified components. +### 4. BaseObj Simplification (COMPLETED) +- [x] Analyze `BaseObj` responsibilities (State, Config, Messaging, Diagnostics). +- [x] Remove pass-through methods for `utils` (Network, MAC, WebClients) to reduce "noise" in the base class. +- [x] Cleaned up commented-out code blocks (`#if false`) to improve readability. ## Progress Log - [x] Created WIP document. - [x] Analyzed `Generic.cs` for Phase 1 candidates. -- [x] Completed Redis Semantic Refactoring: - - Moved key construction logic from `RedisService` to `BaseObj`. - - Refactored `Generic.cs` to use `BaseObj` semantic methods. - - Eliminated redundant `RedisService.cs`. -- [ ] Started Analysis of `BaseObj` to identify extraction candidates. +- [x] Completed Redis Semantic Refactoring. +- [x] Completed BaseObj Cleanup (Removal of redundant wrappers and commented code). +- [x] Verified compilation stability after removing `BaseObj` wrappers. +- [ ] **Next Task**: Data Serializer Extraction.