Fix chiamate su adapter OPC-UA e SQL x callUrl

This commit is contained in:
Samuele Locatelli
2026-05-20 19:34:59 +02:00
parent eb3f6b721d
commit 6cf0bbef12
6 changed files with 27 additions and 27 deletions
+3 -3
View File
@@ -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
+5 -5
View File
@@ -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();
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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();
+14 -14
View File
@@ -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.