diff --git a/IOB-WIN-FILE/App.config b/IOB-WIN-FILE/App.config
index 92b30df3..d582ce3e 100644
--- a/IOB-WIN-FILE/App.config
+++ b/IOB-WIN-FILE/App.config
@@ -5,7 +5,7 @@
-
+
@@ -111,15 +111,15 @@
-
+
-
+
-
+
@@ -127,15 +127,15 @@
-
+
-
+
-
+
@@ -147,7 +147,7 @@
-
+
@@ -163,7 +163,7 @@
-
+
@@ -179,4 +179,4 @@
-
\ No newline at end of file
+
diff --git a/IOB-WIN-FILE/IOB-WIN-FILE.csproj b/IOB-WIN-FILE/IOB-WIN-FILE.csproj
index 912ac2e5..07d13125 100644
--- a/IOB-WIN-FILE/IOB-WIN-FILE.csproj
+++ b/IOB-WIN-FILE/IOB-WIN-FILE.csproj
@@ -8,12 +8,13 @@
WinExe
IOB_WIN_FILE
IOB-WIN-FILE
- v4.6.2
+ v4.7.2
512
true
true
+
AnyCPU
@@ -44,14 +45,48 @@
prompt
-
- ..\packages\MapoSDK.6.14.2505.2916\lib\MapoSDK.dll
+
+ ..\packages\MapoSDK.6.14.2509.1018\lib\MapoSDK.dll
+
+
+ ..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net472\Pipelines.Sockets.Unofficial.dll
+
+
+ ..\packages\StackExchange.Redis.2.10.1\lib\net472\StackExchange.Redis.dll
+
+
+ ..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll
+
+
+
+ ..\packages\System.IO.Hashing.9.0.10\lib\net462\System.IO.Hashing.dll
+
+
+ ..\packages\System.IO.Pipelines.10.0.0\lib\net462\System.IO.Pipelines.dll
+
+
+ ..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll
+
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll
+
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll
+
@@ -92,6 +127,7 @@
True
Resources.resx
+ True
App.config
diff --git a/IOB-WIN-FILE/IobFile/FileGen.cs b/IOB-WIN-FILE/IobFile/FileGen.cs
index c1340bfa..3cc15258 100644
--- a/IOB-WIN-FILE/IobFile/FileGen.cs
+++ b/IOB-WIN-FILE/IobFile/FileGen.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
+using System.Threading.Tasks;
namespace IOB_WIN_FILE.IobFile
{
@@ -170,7 +171,7 @@ namespace IOB_WIN_FILE.IobFile
///
///
///
- public override void stopAdapter(bool tryRestart, bool forceDequeue)
+ public override async Task stopAdapter(bool tryRestart, bool forceDequeue)
{
try
{
@@ -187,7 +188,7 @@ namespace IOB_WIN_FILE.IobFile
lgError(exc, "Eccezione in tryDisconnect");
}
// continuo
- base.stopAdapter(tryRestart, forceDequeue);
+ await base.stopAdapter(tryRestart, forceDequeue);
}
///
diff --git a/IOB-WIN-FILE/Properties/Resources.Designer.cs b/IOB-WIN-FILE/Properties/Resources.Designer.cs
index 6f127a7f..56bf4ee9 100644
--- a/IOB-WIN-FILE/Properties/Resources.Designer.cs
+++ b/IOB-WIN-FILE/Properties/Resources.Designer.cs
@@ -8,10 +8,10 @@
//
//------------------------------------------------------------------------------
-namespace IOB_WIN_FILE.Properties
-{
-
-
+namespace IOB_WIN_FILE.Properties {
+ using System;
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -19,51 +19,43 @@ namespace IOB_WIN_FILE.Properties
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
+ internal class Resources {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
+ internal Resources() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IOB_WIN_FILE.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
diff --git a/IOB-WIN-FILE/Properties/Settings.Designer.cs b/IOB-WIN-FILE/Properties/Settings.Designer.cs
index 17aa149f..96943a97 100644
--- a/IOB-WIN-FILE/Properties/Settings.Designer.cs
+++ b/IOB-WIN-FILE/Properties/Settings.Designer.cs
@@ -8,21 +8,17 @@
//
//------------------------------------------------------------------------------
-namespace IOB_WIN_FILE.Properties
-{
-
-
+namespace IOB_WIN_FILE.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [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())));
-
- public static Settings Default
- {
- get
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
diff --git a/IOB-WIN-FILE/packages.config b/IOB-WIN-FILE/packages.config
index b435bc4f..5b715800 100644
--- a/IOB-WIN-FILE/packages.config
+++ b/IOB-WIN-FILE/packages.config
@@ -1,23 +1,24 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/IOB-WIN-FORM/Iob/Generic.Protected.cs b/IOB-WIN-FORM/Iob/Generic.Protected.cs
index 838a6fad..960f3e7d 100644
--- a/IOB-WIN-FORM/Iob/Generic.Protected.cs
+++ b/IOB-WIN-FORM/Iob/Generic.Protected.cs
@@ -2212,27 +2212,28 @@ namespace IOB_WIN_FORM.Iob
/// Recupera elenco PODL assegnabili
///
///
- protected async Task> MachineNextPodl()
+ protected List MachineNextPodl()
{
List reqPOdlList = new List();
// per prima cosa recupero elenco PODL da gestire....
- var rawListPODL = await callUrl(urlGetNextPODL, false);
- if (!string.IsNullOrEmpty(rawListPODL))
+ try
{
- try
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
{
- reqPOdlList = JsonConvert.DeserializeObject>(rawListPODL);
- }
- catch (Exception exc)
- {
- lg.Error($"Errore: chiamata elenco PODL ha restituito errore{Environment.NewLine}{exc}");
- }
+ var rawListPODL = await callUrl(urlGetNextPODL, false);
+ if (!string.IsNullOrEmpty(rawListPODL))
+ {
+ reqPOdlList = JsonConvert.DeserializeObject>(rawListPODL) ?? new List();
+ }
+ })
+ .GetAwaiter()
+ .GetResult();
}
- else
+ catch (Exception ex)
{
- lg.Error($"Errore: chiamata elenco PODL ({urlGetNextPODL}) ha restituito valore vuoto");
+ lg.Error($"Errore: chiamata MachineNextPodl: {ex.Message}");
}
-
return reqPOdlList;
}
@@ -3169,12 +3170,27 @@ namespace IOB_WIN_FORM.Iob
///
/// Idx del PODL da chiudere
/// DataOra di riferimento evento stop
- protected async Task SendClosePOdl(int idxPOdl, DateTime dtRif)
+ protected bool SendClosePOdl(int idxPOdl, DateTime dtRif)
{
bool answ = false;
DateTime dtCurr = DateTime.Now;
- string resp = await callUrl($"{urlPODLClose}{idxPOdl}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}", false);
- answ = resp == "OK";
+ string fullUrl = $"{urlPODLClose}{idxPOdl}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}";
+ try
+ {
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ // invio chiamata URL x chiusura ODL su macchina
+ string callResp = await callUrl(fullUrl, false);
+ answ = callResp == "OK";
+ })
+ .GetAwaiter()
+ .GetResult();
+ }
+ catch (Exception ex)
+ {
+ lgError($"Errore in SendClosePOdl | {Environment.NewLine}{ex.Message}");
+ }
return answ;
}
@@ -3349,13 +3365,28 @@ namespace IOB_WIN_FORM.Iob
///
/// Num pezzi da registrare
/// DataOra di riferimento evento
- protected async Task SendPzIncrAtDate(int numPz, DateTime dtRif)
+ protected bool SendPzIncrAtDate(int numPz, DateTime dtRif)
{
bool answ = false;
DateTime dtCurr = DateTime.Now;
// chiamata avvio PODL (a posteriori)
- string resp = await callUrl($"{urlAddPzCountAtDate}{numPz}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}", false);
- answ = resp == "OK";
+ string fullUrl = $"{urlAddPzCountAtDate}{numPz}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}";
+ try
+ {
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ // invio chiamata URL x chiusura ODL su macchina
+ string callResp = await callUrl(fullUrl, false);
+ answ = callResp == "OK";
+ })
+ .GetAwaiter()
+ .GetResult();
+ }
+ catch (Exception ex)
+ {
+ lgError($"Errore in SendPzIncrAtDate | {Environment.NewLine}{ex.Message}");
+ }
return answ;
}
@@ -3364,13 +3395,28 @@ namespace IOB_WIN_FORM.Iob
///
/// Idx del PODL da avviare
/// DataOra di riferimento evento start
- protected async Task SendStartPodl(int idxPOdl, DateTime dtRif)
+ protected bool SendStartPodl(int idxPOdl, DateTime dtRif)
{
bool answ = false;
DateTime dtCurr = DateTime.Now;
// chiamata avvio PODL (a posteriori)
- string resp = await callUrl($"{urlOdlStartFromPOdl}{idxPOdl}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}", false);
- answ = resp == "OK";
+ string fullUrl = $"{urlOdlStartFromPOdl}{idxPOdl}&dtEve={dtRif:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}";
+ try
+ {
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ // invio chiamata URL x chiusura ODL su macchina
+ string callResp = await callUrl(fullUrl, false);
+ answ = callResp == "OK";
+ })
+ .GetAwaiter()
+ .GetResult();
+ }
+ catch (Exception ex)
+ {
+ lgError($"Errore in SendStartPodl | {Environment.NewLine}{ex.Message}");
+ }
return answ;
}
@@ -3948,19 +3994,27 @@ namespace IOB_WIN_FORM.Iob
///
///
///
- protected async Task tryClosePODL(int idxPODL)
+ protected bool TryClosePODL(int idxPODL)
{
bool fatto = false;
string fullUrl = $"{urlPODLClose}{idxPODL}";
try
{
- // invio chiamata URL x chiusura ODL su macchina
- string callResp = await callUrl(fullUrl, false);
- fatto = (callResp != "KO") ? true : false;
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ // invio chiamata URL x chiusura ODL su macchina
+ string callResp = await callUrl(fullUrl, false);
+ fatto = (callResp != "KO") ? true : false;
+ })
+ .GetAwaiter()
+ .GetResult();
}
- catch
- { }
- lgInfo($"Eseguito tryClosePODL per {idxPODL} | url: {fullUrl} | esito: {fatto}");
+ catch (Exception ex)
+ {
+ lgError($"Errore in TryClosePODL | idxPODL: {idxPODL}{Environment.NewLine}{ex.Message}");
+ }
+ lgInfo($"Eseguito TryClosePODL per {idxPODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
@@ -3972,19 +4026,27 @@ namespace IOB_WIN_FORM.Iob
///
///
///
- protected async Task tryClosePODL(int idxPODL, DateTime dtEve, DateTime dtCurr)
+ protected bool TryClosePODL(int idxPODL, DateTime dtEve, DateTime dtCurr)
{
bool fatto = false;
string fullUrl = $"{urlPODLClose}{idxPODL}&dtEve={dtEve:yyyyMMddHHmmssfff}&dtCurr={dtCurr:yyyyMMddHHmmssfff}";
try
{
- // invio chiamata URL x chiusura ODL su macchina
- string callResp = await callUrl(fullUrl, false);
- fatto = (callResp != "KO") ? true : false;
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ // invio chiamata URL x chiusura ODL su macchina
+ string callResp = await callUrl(fullUrl, false);
+ fatto = (callResp != "KO") ? true : false;
+ })
+ .GetAwaiter()
+ .GetResult();
}
- catch
- { }
- lgInfo($"Eseguito tryClosePODL per {idxPODL} | url: {fullUrl} | esito: {fatto}");
+ catch (Exception ex)
+ {
+ lgError($"Errore in TryClosePODL | idxPODL: {idxPODL} | dtEve: {dtEve} | dtCurr: {dtCurr}{Environment.NewLine}{ex.Message}");
+ }
+ lgInfo($"Eseguito TryClosePODL per {idxPODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
@@ -3994,12 +4056,25 @@ namespace IOB_WIN_FORM.Iob
/// Cod Articolo del PODL da avviare
/// Cod Gruppo dell'impianto come default
/// num pz richiesti
- protected async Task TryCreatePodl(string codArt, string codGruppo, int numPz)
+ protected int TryCreatePodl(string codArt, string codGruppo, int numPz)
{
int answ = 0;
string urlEncoded = $"{urlCreatePOdl}CodArt={codArt}&CodGruppo={codGruppo}&numPz={numPz}";
- string resp = await callUrl(urlEncoded, false);
- int.TryParse(resp, out answ);
+ try
+ {
+ // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione
+ Task.Run(async () =>
+ {
+ string resp = await callUrl(urlEncoded, false);
+ int.TryParse(resp, out answ);
+ })
+ .GetAwaiter()
+ .GetResult();
+ }
+ catch (Exception ex)
+ {
+ lgError($"Errore in TryCreatePodl | codArt: {codArt} | codGruppo: {codGruppo} | numPz: {numPz}{Environment.NewLine}{ex.Message}");
+ }
return answ;
}
diff --git a/IOB-WIN-FORM/Iob/Simula.cs b/IOB-WIN-FORM/Iob/Simula.cs
index a307d915..549d129e 100644
--- a/IOB-WIN-FORM/Iob/Simula.cs
+++ b/IOB-WIN-FORM/Iob/Simula.cs
@@ -640,8 +640,8 @@ namespace IOB_WIN_FORM.Iob
bool acquireLog = getRemoteLog();
if (acquireLog)
{
- bool sentSignLog = await processSignLogTable(adesso);
- bool sentFluxLog = processFluxLogTable();
+ bool sentSignLog = ProcessSignLogTable(adesso);
+ bool sentFluxLog = ProcessFluxLogTable();
}
}
catch (Exception exc)
@@ -1761,7 +1761,7 @@ namespace IOB_WIN_FORM.Iob
/// Esegue processing + invio dati tab SignLog
///
///
- private bool processFluxLogTable()
+ private bool ProcessFluxLogTable()
{
bool fatto = false;
// leggo eventuali dati di fluxlog ed invio...
@@ -1777,7 +1777,7 @@ namespace IOB_WIN_FORM.Iob
if (kvpFlux[0] == "ND")
{
// log anomalia...
- lgTrace($"Errore in processFluxLogTable: kvpFlux[0] risulta ND! | item.key: {kvpFlux[0]} | item.Value: {kvpFlux[1]}");
+ lgTrace($"Errore in ProcessFluxLogTable: kvpFlux[0] risulta ND! | item.key: {kvpFlux[0]} | item.Value: {kvpFlux[1]}");
}
else
{
@@ -1808,7 +1808,7 @@ namespace IOB_WIN_FORM.Iob
///
///
///
- private async Task processSignLogTable(DateTime adesso)
+ private bool ProcessSignLogTable(DateTime adesso)
{
bool fatto = false;
// init oggetto x processing
@@ -1925,7 +1925,7 @@ namespace IOB_WIN_FORM.Iob
if (currData[0] == "ND")
{
// log anomalia...
- lgTrace($"Errore in processSignLogTable: kvpFlux[0] risulta ND! | item.key: {currData[0]} | item.Value: {currData[1]}");
+ lgTrace($"Errore in ProcessSignLogTable: kvpFlux[0] risulta ND! | item.key: {currData[0]} | item.Value: {currData[1]}");
}
else
{
@@ -2012,7 +2012,7 @@ namespace IOB_WIN_FORM.Iob
}
// recupero elenco PODL corrente...
- List reqPOdlList = await MachineNextPodl();
+ List reqPOdlList = MachineNextPodl();
// adesso processo tutti i prodBatch collezionati x invio
foreach (var item in elencoProdBatch)
{
@@ -2036,20 +2036,20 @@ namespace IOB_WIN_FORM.Iob
else
{
// se NON trovato --> creo PODL, poi avvio/chiudo
- currIdxPOdl = await TryCreatePodl(item.codArt, CodGruppoIob, item.numPz);
+ currIdxPOdl = TryCreatePodl(item.codArt, CodGruppoIob, item.numPz);
}
// se idxPOdl valido
if (currIdxPOdl > 0)
{
// mando apertura PODL
- await SendStartPodl(currIdxPOdl, item.dtStart);
+ SendStartPodl(currIdxPOdl, item.dtStart);
// chiudo PODL...
if (item.dtEnd != null)
{
// invio pezzi 3 sec prima di chiusura
- await SendPzIncrAtDate(item.numPz, ((DateTime)item.dtEnd).AddSeconds(-10));
+ SendPzIncrAtDate(item.numPz, ((DateTime)item.dtEnd).AddSeconds(-10));
// chiudo
- await SendClosePOdl(currIdxPOdl, (DateTime)item.dtEnd);
+ SendClosePOdl(currIdxPOdl, (DateTime)item.dtEnd);
}
}
}