Fix FILE IOB

This commit is contained in:
Samuele Locatelli
2026-01-07 19:24:56 +01:00
parent ab38bdcf35
commit b80631f2ee
8 changed files with 216 additions and 115 deletions
+10 -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-FILE" />
@@ -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" />
@@ -147,7 +147,7 @@
</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="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -163,7 +163,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FluentFTP" publicKeyToken="f4af092b1d8df44f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-52.0.0.0" newVersion="52.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-53.0.2.0" newVersion="53.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -179,4 +179,4 @@
</providers>
</roleManager>
</system.web>
</configuration>
</configuration>
+39 -3
View File
@@ -8,12 +8,13 @@
<OutputType>WinExe</OutputType>
<RootNamespace>IOB_WIN_FILE</RootNamespace>
<AssemblyName>IOB-WIN-FILE</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>
@@ -44,14 +45,48 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="MapoSDK, Version=6.14.2505.2916, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2505.2916\lib\MapoSDK.dll</HintPath>
<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=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>
</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>
</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\net472\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.10.1\lib\net472\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="System" />
<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>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<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.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>
</Reference>
<Reference Include="System.Numerics" />
<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>
</Reference>
<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>
</Reference>
<Reference Include="System.Runtime.InteropServices" />
<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>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -92,6 +127,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.Debug.config">
<DependentUpon>App.config</DependentUpon>
+3 -2
View File
@@ -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
/// </summary>
/// <param name="tryRestart"></param>
/// <param name="forceDequeue"></param>
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);
}
/// <summary>
+18 -26
View File
@@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace IOB_WIN_FILE.Properties
{
namespace IOB_WIN_FILE.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[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;
}
}
+9 -13
View File
@@ -8,21 +8,17 @@
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
+12 -11
View File
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MapoSDK" version="6.14.2505.2916" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.0" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2509.1018" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.0" targetFramework="net472" />
<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="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net472" developmentDependency="true" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="NLog" version="5.3.4" targetFramework="net462" />
<package id="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net462" />
<package id="StackExchange.Redis" version="2.8.24" targetFramework="net462" />
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
<package id="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net472" />
<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="net462" />
<package id="System.Diagnostics.PerformanceCounter" version="9.0.0" targetFramework="net462" />
<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.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
</packages>
+114 -39
View File
@@ -2212,27 +2212,28 @@ namespace IOB_WIN_FORM.Iob
/// Recupera elenco PODL assegnabili
/// </summary>
/// <returns></returns>
protected async Task<List<PODLModel>> MachineNextPodl()
protected List<PODLModel> MachineNextPodl()
{
List<PODLModel> reqPOdlList = new List<PODLModel>();
// 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<List<PODLModel>>(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<List<PODLModel>>(rawListPODL) ?? new List<PODLModel>();
}
})
.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
/// </summary>
/// <param name="idxPOdl">Idx del PODL da chiudere</param>
/// <param name="dtRif">DataOra di riferimento evento stop</param>
protected async Task<bool> 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
/// </summary>
/// <param name="numPz">Num pezzi da registrare</param>
/// <param name="dtRif">DataOra di riferimento evento</param>
protected async Task<bool> 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
/// </summary>
/// <param name="idxPOdl">Idx del PODL da avviare</param>
/// <param name="dtRif">DataOra di riferimento evento start</param>
protected async Task<bool> 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
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
protected async Task<bool> 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
/// <param name="dtEve"></param>
/// <param name="dtCurr"></param>
/// <returns></returns>
protected async Task<bool> 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
/// <param name="codArt">Cod Articolo del PODL da avviare</param>
/// <param name="codGruppo">Cod Gruppo dell'impianto come default</param>
/// <param name="numPz">num pz richiesti</param>
protected async Task<int> 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;
}
+11 -11
View File
@@ -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
/// </summary>
/// <returns></returns>
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
/// </summary>
/// <param name="adesso"></param>
/// <returns></returns>
private async Task<bool> 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<PODLModel> reqPOdlList = await MachineNextPodl();
List<PODLModel> 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);
}
}
}