Merge branch 'release/TestSimUfficio_04'

This commit is contained in:
Samuele Locatelli
2026-05-21 18:19:59 +02:00
21 changed files with 72 additions and 59 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
using EgwProxy.MultiCncLib.CNC;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using NLog;
using System;
@@ -2637,7 +2638,7 @@ namespace IOB_WIN_FANUC.Iob
lgInfo($"contapezziPLC FANUC: {contapezziPLC} | contapezziIOB {contapezziIOB}");
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+3 -2
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using System;
using System.Collections.Generic;
@@ -865,7 +866,7 @@ namespace IOB_WIN_KAWASAKI.Iob
{
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (string.IsNullOrEmpty(currODL) || currODL == "0")
{
@@ -933,7 +934,7 @@ namespace IOB_WIN_KAWASAKI.Iob
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+2 -2
View File
@@ -1619,7 +1619,7 @@ namespace IOB_WIN_MITSUBISHI.Iob
{
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (string.IsNullOrEmpty(currODL) || currODL == "0")
{
@@ -1685,7 +1685,7 @@ namespace IOB_WIN_MITSUBISHI.Iob
lgInfo($"contapezziPLC MITSUBISHI: {contapezziPLC} | contapezziIOB {contapezziIOB}");
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+2 -1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using MTConnect.Assets;
using MTConnect.Clients;
@@ -2037,7 +2038,7 @@ namespace IOB_WIN_MTC.Iob
if (adesso > dtVetoSenDataItem)
{
string rawData = JsonConvert.SerializeObject(dataItems);
var resp = utils.CallUrlPost($"{urlSaveDataItems}", rawData);
var resp = HttpService.CallUrlPost($"{urlSaveDataItems}", rawData);
// imposto nuovo veto
dtVetoSenDataItem = adesso.AddMinutes(minVetoSendDataItem);
}
+2 -1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using System;
using System.Collections.Generic;
@@ -720,7 +721,7 @@ namespace IOB_WIN_OMRON.Iob
{
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (string.IsNullOrEmpty(currODL) || currODL == "0")
{
+3 -2
View File
@@ -1,6 +1,7 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.DataModel;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using NLog;
@@ -2908,7 +2909,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
string rawData = JsonConvert.SerializeObject(dataItems);
try
{
utils.CallUrlPost($"{urlSaveDataItems}", rawData);
HttpService.CallUrlPost($"{urlSaveDataItems}", rawData);
lgInfo($"Effettuata chiamata sendDataItemsList all'url {urlSaveDataItems}");
}
catch (Exception exc)
@@ -2945,7 +2946,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
{
// recupero valore dal server MES (se disponibile)
string pzCountMesUrl = $"{urlGetPzCountRec}|{item.Key}";
string rawCount = utils.callUrl(pzCountMesUrl);
string rawCount = HttpService.CallUrl(pzCountMesUrl);
if (!string.IsNullOrEmpty(rawCount))
{
int.TryParse(rawCount, out actVal);
+4 -3
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using Opc.Ua;
@@ -79,10 +80,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 utils.callUrlAsync(urlGetCurrArt);
var rawListDOSS = await utils.callUrlAsync(urlGetCurrDOSS);
var rawListArt = await HttpService.CallUrlAsync(urlGetCurrArt);
var rawListDOSS = await HttpService.CallUrlAsync(urlGetCurrDOSS);
// fixme todo verificare se usare urlGetActPODL
var rawListPODL = await utils.callUrlAsync(urlGetNextPODL);
var rawListPODL = await HttpService.CallUrlAsync(urlGetNextPODL);
if (!string.IsNullOrEmpty(rawListArt))
{
try
+6 -5
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using System;
@@ -446,10 +447,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 utils.callUrlAsync(urlGetCurrArt);
var rawListDOSS =await utils.callUrlAsync(urlGetCurrDOSS);
var rawListPODL = await utils.callUrlAsync(urlGetNextPODL);
var rawLVFasi = await utils.callUrlAsync(urlGetListValFasiPodl);
var rawListArt = await HttpService.CallUrlAsync(urlGetCurrArt);
var rawListDOSS =await HttpService.CallUrlAsync(urlGetCurrDOSS);
var rawListPODL = await HttpService.CallUrlAsync(urlGetNextPODL);
var rawLVFasi = await HttpService.CallUrlAsync(urlGetListValFasiPodl);
if (!string.IsNullOrEmpty(rawListArt))
{
try
@@ -592,7 +593,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
await utils.callUrlAsync(urlTakeSnapshot);
await HttpService.CallUrlAsync(urlTakeSnapshot);
})
.GetAwaiter()
.GetResult();
+4 -3
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using Opc.Ua;
@@ -149,9 +150,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 utils.callUrlAsync(urlGetCurrArt);
var rawListDOSS = await utils.callUrlAsync(urlGetCurrDOSS);
var rawListPODL = await utils.callUrlAsync(urlGetActPODL);
var rawListArt = await HttpService.CallUrlAsync(urlGetCurrArt);
var rawListDOSS = await HttpService.CallUrlAsync(urlGetCurrDOSS);
var rawListPODL = await HttpService.CallUrlAsync(urlGetActPODL);
if (!string.IsNullOrEmpty(rawListArt))
{
try
+3 -2
View File
@@ -2,6 +2,7 @@
using EgwProxy.OsaiCncLib;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using System;
using System.Collections.Generic;
@@ -669,7 +670,7 @@ namespace IOB_WIN_OSAI.Iob
{
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (string.IsNullOrEmpty(currODL) || currODL == "0")
{
@@ -730,7 +731,7 @@ namespace IOB_WIN_OSAI.Iob
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
@@ -673,7 +673,7 @@ namespace IOB_WIN
string currODL = "";
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (currODL == "" || currODL == "0")
{
@@ -726,7 +726,7 @@ namespace IOB_WIN
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezzi.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezzi.ToString());
// verifica se tutto OK
if (retVal != "OK")
{
+2 -1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -184,7 +185,7 @@ namespace IOB_WIN_SIEMENS.IobSiemens
if (needRefreshPzCount)
{
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+2 -1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -289,7 +290,7 @@ namespace IOB_WIN_SIEMENS.IobSiemens
if (needRefreshPzCount)
{
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+2 -1
View File
@@ -2,6 +2,7 @@
using EgwProxy.SqlDb.DbModels;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using System;
@@ -114,7 +115,7 @@ namespace IOB_WIN_SQL.IobSql
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
rawListPODL = await utils.callUrlAsync(urlGetNextPODL);
rawListPODL = await HttpService.CallUrlAsync(urlGetNextPODL);
})
.GetAwaiter()
.GetResult();
+2 -1
View File
@@ -2,6 +2,7 @@
using EgwProxy.SqlDb.DbModels;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Iob.Services;
using MapoSDK;
using Newtonsoft.Json;
using System;
@@ -112,7 +113,7 @@ namespace IOB_WIN_SQL.IobSql
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
rawListPODL = await utils.callUrlAsync(urlGetNextPODL);
rawListPODL = await HttpService.CallUrlAsync(urlGetNextPODL);
})
.GetAwaiter()
.GetResult();
+19 -19
View File
@@ -2173,11 +2173,11 @@ namespace IOB_WIN
{
lgInfo("chiamata URL " + url2call);
}
answ = utils.callUrlNow(url2call);
answ = HttpService.CallUrlNow(url2call);
// se vuoto faccio seconda prova...
if (string.IsNullOrEmpty(answ))
{
answ = utils.callUrlNow(url2call);
answ = HttpService.CallUrlNow(url2call);
}
return answ;
}
@@ -2200,7 +2200,7 @@ namespace IOB_WIN
{
lgInfo("chiamata URL " + url2call);
}
answ = utils.callUrlNow(url2call);
answ = HttpService.CallUrlNow(url2call);
}
return answ;
}
@@ -2462,7 +2462,7 @@ namespace IOB_WIN
{
// invio su cloud conf memoria...
string rawData = JsonConvert.SerializeObject(memMap);
utils.callUrlNow($"{urlSaveMemMap}", rawData);
HttpService.CallUrlNow($"{urlSaveMemMap}", rawData);
// salvo ANCHE come parametri i valori...
objItem currItem = new objItem();
List<objItem> allParam = new List<objItem>();
@@ -2490,7 +2490,7 @@ namespace IOB_WIN
}
// invio su cloud parametri!
rawData = JsonConvert.SerializeObject(allParam);
utils.callUrl($"{urlSaveAllParams}", rawData);
HttpService.CallUrl($"{urlSaveAllParams}", rawData);
}
}
catch (Exception exc)
@@ -2565,7 +2565,7 @@ namespace IOB_WIN
plcWriteParams(updatedPar);
// invio su cloud parametri!
string rawData = JsonConvert.SerializeObject(updatedPar);
utils.callUrl($"{urlUpdateWriteParams}", rawData);
HttpService.CallUrl($"{urlUpdateWriteParams}", rawData);
}
}
catch (Exception exc)
@@ -2608,7 +2608,7 @@ namespace IOB_WIN
{
string url2call = $"{urlRemTask2Exe}{taskName}";
lgInfo($"Task2Exe | {esitoTask} | chiamata URL {url2call}");
answ = utils.callUrlNow(url2call);
answ = HttpService.CallUrlNow(url2call);
}
return answ;
}
@@ -2621,7 +2621,7 @@ namespace IOB_WIN
if (checkServerAlive)
{
lgInfo("chiamata URL " + urlSetM2IOB);
utils.callUrlNow(urlSetM2IOB);
HttpService.CallUrlNow(urlSetM2IOB);
}
}
@@ -2636,7 +2636,7 @@ namespace IOB_WIN
{
string url2call = $"{urlSetOptVal}pName={paramName}&pValue={paramValue}";
lgInfo("chiamata URL " + url2call);
utils.callUrlNow(url2call);
HttpService.CallUrlNow(url2call);
}
}
@@ -2737,14 +2737,14 @@ namespace IOB_WIN
// Chiamata ASINCRONA
if (doAsync)
{
//Task<string> resp = utils.callUrlAsync(URL);
//Task<string> resp = HttpService.CallUrlAsync(URL);
//answ = resp.Result;
answ = utils.callUrlAsync(URL);
answ = HttpService.CallUrlAsync(URL);
}
// chiamata SOLO NORMALE SINCRONA...
else
{
answ = utils.callUrl(URL);
answ = HttpService.CallUrl(URL);
}
return answ;
}
@@ -2762,12 +2762,12 @@ namespace IOB_WIN
// Chiamata ASINCRONA
if (doAsync)
{
answ = utils.callUrlAsync(URL, payload);
answ = HttpService.CallUrlAsync(URL, payload);
}
// chiamata SOLO NORMALE SINCRONA...
else
{
answ = utils.callUrl(URL, payload);
answ = HttpService.CallUrl(URL, payload);
}
return answ;
}
@@ -3998,19 +3998,19 @@ namespace IOB_WIN
if (checkServerAlive)
{
// leggo PRIMA ODL ....
lastIdxODL = utils.callUrl(urlGetCurrODL);
lastIdxODL = HttpService.CallUrl(urlGetCurrODL);
lgInfo("Lettura ODL dall'url {0} --> {1}", urlGetCurrODL, lastIdxODL);
// se ho valori in coda da trasmettere uso dati REDIS
if (forceCountRec)
{
// uso dati da TCiclo registrati...
currServerCount = utils.callUrl(urlGetPzCountRec);
currServerCount = HttpService.CallUrl(urlGetPzCountRec);
lgInfo("Lettura contapezzi da TCiclo dall'url {0} --> num pz: {1}", urlGetPzCountRec, currServerCount);
}
else
{
// uso il contapezzi dichiarato dall'IOB stesso
currServerCount = utils.callUrl(urlGetPzCount);
currServerCount = HttpService.CallUrl(urlGetPzCount);
lgInfo("Lettura contapezzi dall'url {0}", urlGetPzCount);
}
// controllo: SE NON HO ODL...
@@ -4640,7 +4640,7 @@ namespace IOB_WIN
numIncr = delta > maxSendPzCountBlock + minSendPzCountBlock ? maxSendPzCountBlock : delta - minSendPzCountBlock;
// invio il num max di pezzi ammesso in blocco!
lastUrl = $"{urlAddPzCount}{numIncr}";
string resp = utils.callUrlNow(lastUrl);
string resp = HttpService.CallUrlNow(lastUrl);
if (!string.IsNullOrEmpty(resp))
{
// dalla risposta (come numero) capisco SE ha aggiunto i pezzi (e quanti)
@@ -4651,7 +4651,7 @@ namespace IOB_WIN
contapezziIOB += qtyAdded;
lgInfo($"Inviato incremento contapezzi: send: {numIncr} | resp: {qtyAdded} | contapezziIOB: {contapezziIOB}");
// invio conferma contapezzi..
string retVal = utils.callUrl($"{urlSetPzCount}{contapezziIOB}");
string retVal = HttpService.CallUrl($"{urlSetPzCount}{contapezziIOB}");
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+2 -2
View File
@@ -214,7 +214,7 @@ namespace IOB_WIN
{
try
{
currODL = utils.callUrl(urlGetCurrODL);
currODL = HttpService.CallUrl(urlGetCurrODL);
// solo SE HO un ODL...
if (string.IsNullOrEmpty(currODL) || currODL == "0")
{
@@ -272,7 +272,7 @@ namespace IOB_WIN
}
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal.Trim() != $"{contapezziIOB}")
{
+3 -3
View File
@@ -246,7 +246,7 @@ namespace IOB_WIN
contapezziIOB++;
needRefreshPzCount = true;
// invio conferma contapezzi..
string retVal = utils.callUrl($"{urlSetPzCount}{contapezziIOB}");
string retVal = HttpService.CallUrl($"{urlSetPzCount}{contapezziIOB}");
// verifica salvataggio
if (retVal != contapezziIOB.ToString())
{
@@ -258,7 +258,7 @@ namespace IOB_WIN
}
else
{
string retVal = utils.callUrl($"{urlSetPzCount}{contapezziIOB}");
string retVal = HttpService.CallUrl($"{urlSetPzCount}{contapezziIOB}");
if (retVal != contapezziIOB.ToString())
{
// errore salvataggio contapezzi
@@ -398,7 +398,7 @@ namespace IOB_WIN
if (checkServerAlive)
{
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
string retVal = HttpService.CallUrl(urlSetPzCount + contapezziIOB.ToString());
// verifica se tutto OK
if (retVal != contapezziIOB.ToString())
{
+5 -5
View File
@@ -330,7 +330,7 @@ namespace IOB_WIN
try
{
// chiamo URL, se restituisce "OK" è alive!
string callResp = utils.callUrl(urlAlive);
string callResp = HttpService.CallUrl(urlAlive);
answ = (callResp == "OK");
}
catch (Exception exc)
@@ -563,7 +563,7 @@ namespace IOB_WIN
// invio in locale!
url2call = $"{urlDownloadFile}{currIob}";
}
rawData = utils.callUrlNow(url2call);
rawData = HttpService.CallUrlNow(url2call);
if (!string.IsNullOrEmpty(rawData))
{
// deserializzo
@@ -894,12 +894,12 @@ namespace IOB_WIN
if (utils.CRB("ConfToCloud"))
{
// invio su cloud...
answ = utils.callUrl($"{urlUploadFileCloud}{currIob}", rawData);
answ = HttpService.CallUrl($"{urlUploadFileCloud}{currIob}", rawData);
}
else
{
// invio in locale!
answ = utils.callUrl($"{urlUploadFile}{currIob}", rawData);
answ = HttpService.CallUrl($"{urlUploadFile}{currIob}", rawData);
}
}
catch (Exception exc)
@@ -1026,7 +1026,7 @@ namespace IOB_WIN
if (pingStatus == IPStatus.Success)
{
// segnalo reboot (programma)...
utils.callUrl(urlReboot);
HttpService.CallUrl(urlReboot);
}
else
{
+1 -1
View File
@@ -10,7 +10,7 @@ Extract infrastructure and helper components from `Generic.cs` to improve modula
### 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, eliminating the unnecessary indirection layer.
- [x] Updated `Generic.cs` to call `HttpService.CallUrl` directly, eliminating the unnecessary indirection layer.
### 2. Redis Service Extraction (COMPLETED)
- [x] Encapsulate all `redisMan` calls into a `RedisService`.
+1 -1
View File
@@ -9,7 +9,7 @@
2. **Polling Frequente**:
- `processVHF()`: Gestisce i decrementi dei timer basandosi su `periodoMSec`.
- `getDynData()`: Genera dati random walk/level basandosi su `waitSimPar`.
3. **Operazioni I/O Sincrone**: Uso di `utils.callUrl` all'interno di cicli di simulazione/polling.
3. **Operazioni I/O Sincrone**: Uso di `HttpService.CallUrl` all'interno di cicli di simulazione/polling.
## Strategie di Intervento Applicate