Update OPC-UA

This commit is contained in:
Samuele Locatelli
2026-01-08 09:02:32 +01:00
parent d8a5b2b57a
commit 15a6ed10b2
12 changed files with 561 additions and 354 deletions
+103 -8
View File
@@ -1824,9 +1824,8 @@ namespace IOB_WIN_FORM.Iob
/// Recupera da server set di dati specifici x IOB
/// </summary>
/// <returns></returns>
protected virtual async Task<bool> iobGetDataFromServer()
protected virtual bool IobGetDataFromServer()
{
await Task.Delay(1);
return false;
}
@@ -3927,12 +3926,36 @@ namespace IOB_WIN_FORM.Iob
redisMan.redDelKey(rKey);
}
/// <summary>
/// Versione sync richiesta chiusura ODL corrente
/// </summary>
/// <returns></returns>
protected bool TryAskCloseCurrODL()
{
bool fatto = false;
try
{
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
fatto = await TryAskCloseCurrODLAsync();
})
.GetAwaiter()
.GetResult();
}
catch (Exception ex)
{
lgError($"Errore in TryAskCloseCurrODL{Environment.NewLine}{ex.Message}");
}
return fatto;
}
/// <summary>
/// Effettua chiamata MP-IO per chiedere all'utente se vuole effettuare chiusura ODL
/// corrente della macchina
/// </summary>
/// <returns></returns>
protected async Task<bool> tryAskCloseCurrODL()
protected async Task<bool> TryAskCloseCurrODLAsync()
{
bool fatto = false;
string fullUrl = $"{urlODLAskClose}{currIdxODL}";
@@ -3944,7 +3967,31 @@ namespace IOB_WIN_FORM.Iob
}
catch
{ }
lgInfo($"Eseguito tryAskCloseCurrODL per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
lgInfo($"Eseguito TryAskCloseCurrODLAsync per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
/// <summary>
/// Versione sync chiusura ODL corrente
/// </summary>
/// <returns></returns>
protected bool TryCloseCurrODL()
{
bool fatto = false;
try
{
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
fatto= await TryCloseCurrODLAsync();
})
.GetAwaiter()
.GetResult();
}
catch (Exception ex)
{
lgError($"Errore in TryCloseCurrODLAsync{Environment.NewLine}{ex.Message}");
}
return fatto;
}
@@ -3952,7 +3999,7 @@ namespace IOB_WIN_FORM.Iob
/// Effettua chiamata MP-IO per tentare chiusura ODL corrente della macchina
/// </summary>
/// <returns></returns>
protected async Task<bool> tryCloseCurrODL()
protected async Task<bool> TryCloseCurrODLAsync()
{
bool fatto = false;
string fullUrl = $"{urlODLClose}{currIdxODL}";
@@ -3964,16 +4011,40 @@ namespace IOB_WIN_FORM.Iob
}
catch
{ }
lgInfo($"Eseguito tryCloseCurrODL per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
lgInfo($"Eseguito TryCloseCurrODLAsync per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
/// <summary>
/// Versione sync chiusura ODL specifico
/// </summary>
/// <param name="IdxODL"></param>
/// <returns></returns>
protected bool TryCloseODL(int IdxODL)
{
bool fatto = false;
try
{
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
fatto = await TryCloseODLAsync(IdxODL);
})
.GetAwaiter()
.GetResult();
}
catch (Exception ex)
{
lgError($"Errore in TryCloseODLAsync | IdxODL: {IdxODL}{Environment.NewLine}{ex.Message}");
}
return fatto;
}
/// <summary>
/// Effettua chiamata MP-IO per tentare chiusura ODL specifico
/// </summary>
/// <param name="IdxODL"></param>
/// <returns></returns>
protected async Task<bool> tryCloseODL(int IdxODL)
protected async Task<bool> TryCloseODLAsync(int IdxODL)
{
bool fatto = false;
string fullUrl = $"{urlODLClose}{IdxODL}";
@@ -3985,7 +4056,7 @@ namespace IOB_WIN_FORM.Iob
}
catch
{ }
lgInfo($"Eseguito tryCloseODL per {IdxODL} | url: {fullUrl} | esito: {fatto}");
lgInfo($"Eseguito TryCloseODLAsync per {IdxODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
@@ -4293,6 +4364,30 @@ namespace IOB_WIN_FORM.Iob
}
raiseRefresh(currDispData);
}
/// <summary>
/// Versione sync chiamata setup PODL
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
protected bool TrySetupPODL(int idxPODL)
{
bool fatto = false;
try
{
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
fatto= await TrySetupPODLAsync(idxPODL);
})
.GetAwaiter()
.GetResult();
}
catch (Exception ex)
{
lgError($"Errore in TrySetupPODL | idxPODL: {idxPODL}{Environment.NewLine}{ex.Message}");
}
return fatto;
}
/// <summary>
/// Effettua chiamata MP-IO per tentare setup del PODL indicato
+147 -118
View File
@@ -871,16 +871,16 @@ namespace IOB_WIN_FORM.Iob
/// - versione Kepware: test recupero parametri ricetta
/// </summary>
/// <returns></returns>
protected override async Task<bool> iobGetDataFromServer()
protected override bool IobGetDataFromServer()
{
bool answ = false;
if (!string.IsNullOrEmpty(getOptPar("SIM_KWP")))
{
answ = await iobGetSendDossierKepware();
answ = IobGetSendDossierKepware();
}
else
{
answ = await iobGetDataFromServerToFtp();
answ = IobGetDataFromServerToFtp();
}
return answ;
}
@@ -974,15 +974,15 @@ namespace IOB_WIN_FORM.Iob
// task non async
var taskWrite = iobWriteLocalCSV();
var taskSend = iobSendFTP("");
var taskGet = IobGetDataFromServer();
// Avviamo tutti i task Async contemporaneamente
var taskGet = iobGetDataFromServer();
var taskOdl = ProcessAutoOdlAsync();
var taskImport = ProcessFileImportAsync();
var taskRecipe = ProcessRecipeFileRetAsync();
// Attendiamo che TUTTI finiscano (Parallelismo)
await Task.WhenAll(taskGet, taskOdl, taskImport, taskRecipe);
await Task.WhenAll(taskOdl, taskImport, taskRecipe);
// ProcessAutoDossier (se è sincrono) lo chiamiamo qui o fuori
ProcessAutoDossier();
@@ -1513,7 +1513,7 @@ namespace IOB_WIN_FORM.Iob
/// Recupero dati da server x costruzione files CSV da inviare via FTP (ex: Cimolai)
/// </summary>
/// <returns></returns>
private async Task<bool> iobGetDataFromServerToFtp()
private bool IobGetDataFromServerToFtp()
{
bool answ;
bool okArt = false;
@@ -1526,75 +1526,91 @@ namespace IOB_WIN_FORM.Iob
List<ListVal> anagLVFasi = new List<ListVal>();
Dictionary<string, string> dictAF = new Dictionary<string, string>();
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetNextPODL, false);
var rawLVFasi = await callUrl(urlGetListValFasiPodl, false);
if (!string.IsNullOrEmpty(rawListArt))
try
{
try
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetNextPODL, false);
var rawLVFasi = await callUrl(urlGetListValFasiPodl, false);
if (!string.IsNullOrEmpty(rawListArt))
{
try
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawLVFasi))
{
try
{
anagLVFasi = JsonConvert.DeserializeObject<List<ListVal>>(rawLVFasi);
dictAF = anagLVFasi.ToDictionary(x => x.value, x => x.label);
okLVFasi = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ListVal ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ListVal ({urlGetListValFasiPodl}) ha restituito valore vuoto");
}
})
.GetAwaiter()
.GetResult();
}
else
catch (Exception ex)
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawLVFasi))
{
try
{
anagLVFasi = JsonConvert.DeserializeObject<List<ListVal>>(rawLVFasi);
dictAF = anagLVFasi.ToDictionary(x => x.value, x => x.label);
okLVFasi = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ListVal ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ListVal ({urlGetListValFasiPodl}) ha restituito valore vuoto");
lgError($"Errore in IobGetDataFromServerToFtp | {Environment.NewLine}{ex.Message}");
}
// continuo
answ = okPodl && okDoss && okArt && okLVFasi;
if (answ)
{
@@ -1636,7 +1652,7 @@ namespace IOB_WIN_FORM.Iob
/// Recupero dati da server x invio dati ricetta a KepWare (Ex RAMA x TFT)
/// </summary>
/// <returns></returns>
private async Task<bool> iobGetSendDossierKepware()
private bool IobGetSendDossierKepware()
{
bool answ;
@@ -1662,58 +1678,71 @@ namespace IOB_WIN_FORM.Iob
List<PODLModel> listaPODL = new List<PODLModel>();
List<DossiersModel> listaDoss = new List<DossiersModel>();
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetNextPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
try
{
try
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetNextPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
{
try
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
})
.GetAwaiter()
.GetResult();
}
else
catch (Exception ex)
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
lgError($"Errore in IobGetSendDossierKepware | {Environment.NewLine}{ex.Message}");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
// continuo
answ = okArt && okPodl && okDoss;
if (answ)
{
+14 -10
View File
@@ -5,7 +5,7 @@
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<add key="appName" value="IOB-WIN-OPC-UA" />
@@ -111,15 +111,15 @@
<probing privatePath="lib;libs" xmlns="urn:schemas-microsoft-com:asm.v1" />
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -127,15 +127,15 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Web.WebView2.WinForms" publicKeyToken="2a8ab48044d2601e" culture="neutral" />
@@ -163,11 +163,15 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FluentFTP" publicKeyToken="f4af092b1d8df44f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-52.1.0.0" newVersion="52.1.0.0" />
<bindingRedirect oldVersion="0.0.0.0-53.0.2.0" newVersion="53.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -183,4 +187,4 @@
</providers>
</roleManager>
</system.web>
</configuration>
</configuration>
+47 -25
View File
@@ -8,12 +8,13 @@
<OutputType>WinExe</OutputType>
<RootNamespace>IOB_WIN_OPC_UA</RootNamespace>
<AssemblyName>IOB-WIN-OPC-UA</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -46,95 +47,114 @@
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MapoSDK, Version=6.14.2509.1018, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2509.1018\lib\MapoSDK.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.9.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.3.4\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Client, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Client.1.5.374.158\lib\netstandard2.0\Opc.Ua.Client.dll</HintPath>
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Client.1.5.374.158\lib\net472\Opc.Ua.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Opc.Ua.Configuration, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.5.374.158\lib\netstandard2.0\Opc.Ua.Configuration.dll</HintPath>
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.5.374.158\lib\net472\Opc.Ua.Configuration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Opc.Ua.Core, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.5.374.158\lib\netstandard2.0\Opc.Ua.Core.dll</HintPath>
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.5.374.158\lib\net472\Opc.Ua.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Opc.Ua.Security.Certificates, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.5.374.158\lib\netstandard2.0\Opc.Ua.Security.Certificates.dll</HintPath>
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.5.374.158\lib\net472\Opc.Ua.Security.Certificates.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net472\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="S7.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL">
<HintPath>..\packages\S7netplus.0.1.9\lib\net45\S7.Net.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.8.58\lib\net461\StackExchange.Redis.dll</HintPath>
<HintPath>..\packages\StackExchange.Redis.2.10.1\lib\net472\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Diagnostics.PerformanceCounter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.9.0.0\lib\net462\System.Diagnostics.PerformanceCounter.dll</HintPath>
</Reference>
<Reference Include="System.Formats.Asn1, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Asn1.9.0.0\lib\net462\System.Formats.Asn1.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Pipelines, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.9.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Hashing, Version=9.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Hashing.9.0.10\lib\net462\System.IO.Hashing.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.10.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Channels, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.9.0.0\lib\net462\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -346,12 +366,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
<Error Condition="!Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets'))" />
</Target>
<Target Name="AfterBuild">
<ItemGroup>
@@ -363,4 +383,6 @@
<Exec Command="$(ProjectDir)postBuildTgt.bat $(ConfigurationName) $(TargetDir)">
</Exec>
</Target>
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
<Import Project="..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets" Condition="Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" />
</Project>
+1 -1
View File
@@ -665,7 +665,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
foreach (var item in dictCounters)
{
int actVal = 0;
if (checkServerAlive)
if (CheckServerAlive())
{
// recupero valore dal server MES (se disponibile)
string pzCountMesUrl = $"{urlGetPzCountRec}|{item.Key}";
+62 -48
View File
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
using static IOB_UT_NEXT.CustomObj;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -73,59 +74,72 @@ namespace IOB_WIN_OPC_UA.IobOpc
List<PODLModel> listaPODL = new List<PODLModel>();
List<DossiersModel> listaDoss = new List<DossiersModel>();
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
var rawListArt = callUrl(urlGetCurrArt, false);
var rawListDOSS = callUrl(urlGetCurrDOSS, false);
// fixme todo verificare se usare urlGetActPODL
var rawListPODL = callUrl(urlGetNextPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
try
{
try
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
// fixme todo verificare se usare urlGetActPODL
var rawListPODL = await callUrl(urlGetNextPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
{
try
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
})
.GetAwaiter()
.GetResult();
}
else
catch (Exception ex)
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
lgError($"Errore in iobGetSendDossierKepware | {Environment.NewLine}{ex.Message}");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
// continuo verifica
answ = okArt && okPodl && okDoss;
if (answ)
{
+99 -71
View File
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
using static IOB_UT_NEXT.CustomObj;
namespace IOB_WIN_OPC_UA.IobOpc
@@ -362,15 +363,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
int.TryParse(sPODL, out idxPODL);
// chiamo richiesta setup PODL...
lgInfo($"Inizio trySetupPODL per {idxPODL}");
trySetupPODL(idxPODL);
TrySetupPODL(idxPODL);
lgInfo("--------------------------------------------");
}
else
{
lgInfo("--------------------------------------------");
lgInfo("Inizio tryCloseODL");
lgInfo("Inizio TryCloseODLAsync");
// registro chiusura ODL..
tryCloseCurrODL();
TryCloseCurrODL();
lgInfo("--------------------------------------------");
}
// registro exe mode
@@ -440,7 +441,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
/// Recupera da server set di dati specifici x IOB : qui per compilare files CSV
/// </summary>
/// <returns></returns>
protected override bool iobGetDataFromServer()
protected override bool IobGetDataFromServer()
{
bool answ = false;
bool okArt = false;
@@ -453,75 +454,89 @@ namespace IOB_WIN_OPC_UA.IobOpc
List<ListVal> anagLVFasi = new List<ListVal>();
Dictionary<string, string> dictAF = new Dictionary<string, string>();
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
var rawListArt = callUrl(urlGetCurrArt, false);
var rawListDOSS = callUrl(urlGetCurrDOSS, false);
var rawListPODL = callUrl(urlGetNextPODL, false);
var rawLVFasi = callUrl(urlGetListValFasiPodl, false);
if (!string.IsNullOrEmpty(rawListArt))
try
{
try
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS =await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetNextPODL, false);
var rawLVFasi = await callUrl(urlGetListValFasiPodl, false);
if (!string.IsNullOrEmpty(rawListArt))
{
try
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco PODL ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawLVFasi))
{
try
{
anagLVFasi = JsonConvert.DeserializeObject<List<ListVal>>(rawLVFasi);
dictAF = anagLVFasi.ToDictionary(x => x.value, x => x.label);
okLVFasi = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ListVal ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ListVal ({urlGetListValFasiPodl}) ha restituito valore vuoto");
}
})
.GetAwaiter()
.GetResult();
}
else
catch (Exception ex)
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco PODL ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawLVFasi))
{
try
{
anagLVFasi = JsonConvert.DeserializeObject<List<ListVal>>(rawLVFasi);
dictAF = anagLVFasi.ToDictionary(x => x.value, x => x.label);
okLVFasi = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ListVal ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ListVal ({urlGetListValFasiPodl}) ha restituito valore vuoto");
lgError($"Errore in IobGetDataFromServer | {Environment.NewLine}{ex.Message}");
}
answ = okPodl && okDoss && okArt && okLVFasi;
if (answ)
{
@@ -568,7 +583,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
lgInfo($"executeTasks --> syncDbData --> processDataSync");
lgInfo("--------------------------------------------");
// effettua sync fixme todo: test scrittura file csv...
var taskGet = iobGetDataFromServer();
var taskGet = IobGetDataFromServer();
var taskWrite = iobWriteLocalCSV();
var taskSend = iobSendFTP("");
}
@@ -585,7 +600,20 @@ namespace IOB_WIN_OPC_UA.IobOpc
if (DateTime.Now > vetoSnapshot)
{
lgInfo("--------------------------------------------");
callUrl(urlTakeSnapshot, false);
try
{
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
await callUrl(urlTakeSnapshot, false);
})
.GetAwaiter()
.GetResult();
}
catch (Exception ex)
{
lgError($"Errore in procRunMode{Environment.NewLine}{ex.Message}");
}
// blocco snapshot x VETO_SEND_SNAPSHOT sec...
vetoSnapshot = DateTime.Now.AddSeconds(IOBConfFull.FluxLog.VetoSendSnapshotSec);
lgInfo($"Effettuata richiesta salvataggio snapshot, veto nuova chiamata fino a {vetoSnapshot}");
@@ -771,7 +799,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
else
{
// chiama richiesta chiusura x utente
tryAskCloseCurrODL();
TryAskCloseCurrODL();
// resetta contatore x nuova richeista finale eventuale...
currTravelStateStart = adesso;
}
+2 -2
View File
@@ -128,7 +128,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
/// <param name="keyReq"></param>
/// <param name="valReq"></param>
/// <returns></returns>
protected override bool processOtherInfo(string keyReq, string valReq)
protected override async Task<bool> processOtherInfo(string keyReq, string valReq)
{
// fixme todo da provare !!!
// la chiave in questo caso è direttamente "processOtherInfo"
@@ -173,7 +173,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
plcWriteParams(ref list2Write);
// sctivo nuovo parametro x spegnere popup...
Thread.Sleep(500);
await Task.Delay(500);
list2Write.Clear();
currData = new objItem()
{
+60 -47
View File
@@ -144,58 +144,71 @@ namespace IOB_WIN_OPC_UA.IobOpc
List<PODLModel> listaPODL = new List<PODLModel>();
List<DossiersModel> listaDoss = new List<DossiersModel>();
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
var rawListArt = callUrl(urlGetCurrArt, false);
var rawListDOSS = callUrl(urlGetCurrDOSS, false);
var rawListPODL = callUrl(urlGetActPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
try
{
try
// PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
Task.Run(async () =>
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
var rawListArt = await callUrl(urlGetCurrArt, false);
var rawListDOSS = await callUrl(urlGetCurrDOSS, false);
var rawListPODL = await callUrl(urlGetActPODL, false);
if (!string.IsNullOrEmpty(rawListArt))
{
try
{
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
okArt = listaArt.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco ART ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetActPODL}) ha restituito valore vuoto");
}
})
.GetAwaiter()
.GetResult();
}
else
catch (Exception ex)
{
lgError($"Errore: chiamata elenco ART ({urlGetCurrArt}) ha restituito valore vuoto");
lgError($"Errore in iobGetSendDossier | {Environment.NewLine}{ex.Message}");
}
if (!string.IsNullOrEmpty(rawListDOSS))
{
try
{
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
okDoss = listaDoss.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco DOSSIER ({urlGetCurrDOSS}) ha restituito valore vuoto");
}
if (!string.IsNullOrEmpty(rawListPODL))
{
try
{
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
okPodl = listaPODL.Count > 0;
}
catch (Exception exc)
{
lgError($"Errore: chiamata elenco DOSSIER ha restituito errore{Environment.NewLine}{exc}");
}
}
else
{
lgError($"Errore: chiamata elenco PODL ({urlGetActPODL}) ha restituito valore vuoto");
}
// continuo verifica
answ = okArt && okPodl && okDoss;
if (answ)
{
+2 -1
View File
@@ -248,7 +248,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
/// <param name="keyReq">chaive memwrite da usare</param>
/// <param name="valReq">valore da scrivere</param>
/// <returns></returns>
protected override bool processOtherInfo(string keyReq, string valReq)
protected override async Task<bool> processOtherInfo(string keyReq, string valReq)
{
bool answ = false;
if (memMap != null && memMap.mMapWrite != null)
@@ -263,6 +263,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
name = keyReq
};
list2Write.Add(currData);
await Task.Delay(1);
// scrivo!
plcWriteParams(ref list2Write);
lgInfo($"processOtherInfo | eseguito plcWriteParams per keyReq: {keyReq} | valReq: {valReq}");
+1 -1
View File
@@ -12,7 +12,7 @@ namespace IOB_WIN_OPC_UA.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+23 -22
View File
@@ -1,32 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net472" />
<package id="MapoSDK" version="6.14.2509.1018" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.0" targetFramework="net462" />
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.0" targetFramework="net462" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net462" developmentDependency="true" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.0" targetFramework="net472" />
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.0" targetFramework="net472" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net472" developmentDependency="true" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.3.4" targetFramework="net462" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Client" version="1.5.374.158" targetFramework="net462" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Configuration" version="1.5.374.158" targetFramework="net462" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Core" version="1.5.374.158" targetFramework="net462" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Security.Certificates" version="1.5.374.158" targetFramework="net462" />
<package id="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net462" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Client" version="1.5.374.158" targetFramework="net472" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Configuration" version="1.5.374.158" targetFramework="net472" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Core" version="1.5.374.158" targetFramework="net472" />
<package id="OPCFoundation.NetStandard.Opc.Ua.Security.Certificates" version="1.5.374.158" targetFramework="net472" />
<package id="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net472" />
<package id="S7netplus" version="0.1.9" targetFramework="net462" />
<package id="StackExchange.Redis" version="2.8.58" targetFramework="net462" />
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
<package id="System.Diagnostics.DiagnosticSource" version="9.0.0" targetFramework="net462" />
<package id="StackExchange.Redis" version="2.10.1" targetFramework="net472" />
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="9.0.0" targetFramework="net472" />
<package id="System.Diagnostics.PerformanceCounter" version="9.0.0" targetFramework="net462" />
<package id="System.Formats.Asn1" version="9.0.0" targetFramework="net462" />
<package id="System.Formats.Asn1" version="9.0.0" targetFramework="net472" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
<package id="System.IO.Pipelines" version="9.0.0" targetFramework="net462" />
<package id="System.Memory" version="4.6.0" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
<package id="System.IO.Hashing" version="9.0.10" targetFramework="net472" />
<package id="System.IO.Pipelines" version="10.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
<package id="System.Threading.Channels" version="9.0.0" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
<package id="System.ValueTuple" version="4.6.1" targetFramework="net472" />
</packages>