Merge branch 'release/TestSimUfficio_05'
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
A collection of .NET (C#/VB) projects for industrial communication with NC controls (Fanuc, Siemens, Mitsubishi, etc.) via the Mapo Protocol.
|
||||
|
||||
## Build & Release
|
||||
- **Toolchain**: MSBuild (`x86` target).
|
||||
- **Config**: Always use `Release` configuration and `x86` platform.
|
||||
- **Toolchain**: MSBuild.
|
||||
- **Config**: Always use `Release` configuration.
|
||||
- **Command Example**:
|
||||
```powershell
|
||||
& "$env:MSBUILD_PATH" "ProjectName\ProjectName.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m
|
||||
& "$env:MSBUILD_PATH" "ProjectName\ProjectName.csproj" -target:Build /p:Configuration=Release /p:OutputPath=bin/ /nodeReuse:false /verbosity:minimal /m
|
||||
```
|
||||
- **NuGet**: Requires Steamware Nexus Proxy sources. Use `dotnet nuget restore` on the specific `.sln` before building.
|
||||
- **Versioning**: Automated via `VersGen\VersGen.cs` and `.nuspec` updates during CI. Manual updates to `VersGen.cs` might be needed if mimicking CI.
|
||||
|
||||
BIN
Binary file not shown.
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static IOB_UT_NEXT.BaseAlarmConf;
|
||||
using static IOB_UT_NEXT.Config.BaseAlarmConf;
|
||||
|
||||
namespace IOB_UT_NEXT.Config.Base
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Config
|
||||
{
|
||||
public class GenActConf
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new INI file to store or load data
|
||||
@@ -1,7 +1,9 @@
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Base;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.Config.Special;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
@@ -16,7 +18,7 @@ using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Threading;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
using static IOB_UT_NEXT.BaseAlarmConf;
|
||||
using static IOB_UT_NEXT.Config.BaseAlarmConf;
|
||||
using static IOB_UT_NEXT.Config.EnumConf;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using IOB_UT_NEXT.Config.Special;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using MapoSDK;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Config.Mem
|
||||
{
|
||||
public class plcMemMapExt : plcMemMap
|
||||
{
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Config
|
||||
namespace IOB_UT_NEXT.Config.Special
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementazione di riferimento x un file di configurazione x esecuzione task tramite EgwCApp
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Config.Special
|
||||
{
|
||||
public class FtpActConf : GenActConf
|
||||
{
|
||||
@@ -2,9 +2,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe gestione configurazione parametri di base x allarmi
|
||||
@@ -156,9 +156,35 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BitUtils.cs" />
|
||||
<Compile Include="ByteDataConverter.cs" />
|
||||
<Compile Include="CallMetricsCollector.cs" />
|
||||
<Compile Include="Iob\DateTimeHelper.cs" />
|
||||
<Compile Include="Iob\QueueHelper.cs" />
|
||||
<Compile Include="Iob\Services\CommunicationService.cs" />
|
||||
<Compile Include="Iob\Services\Machine\MachineCommunicationService.cs" />
|
||||
<Compile Include="Iob\Services\Networking\ServerCommunicationService.cs" />
|
||||
<Compile Include="Objects\CachedInt.cs" />
|
||||
<Compile Include="Objects\CachedString.cs" />
|
||||
<Compile Include="Objects\DynDataItem.cs" />
|
||||
<Compile Include="Objects\Endian.cs" />
|
||||
<Compile Include="Objects\EVData.cs" />
|
||||
<Compile Include="Objects\FtpTaskList.cs" />
|
||||
<Compile Include="Objects\GenLogRow.cs" />
|
||||
<Compile Include="Objects\GenTaskList.cs" />
|
||||
<Compile Include="Objects\MonitoredItemsConf.cs" />
|
||||
<Compile Include="Objects\newDisplayData.cs" />
|
||||
<Compile Include="Objects\otherData.cs" />
|
||||
<Compile Include="Objects\ProdBatchData.cs" />
|
||||
<Compile Include="Objects\prodData.cs" />
|
||||
<Compile Include="Objects\sampleVect.cs" />
|
||||
<Compile Include="Objects\ServerMpStatus.cs" />
|
||||
<Compile Include="Objects\srvData.cs" />
|
||||
<Compile Include="Objects\StatusItem.cs" />
|
||||
<Compile Include="Objects\TimeRec.cs" />
|
||||
<Compile Include="Objects\TimingData.cs" />
|
||||
<Compile Include="Objects\VCData.cs" />
|
||||
<Compile Include="Services\Cache\RedisIobCache.cs" />
|
||||
<Compile Include="Services\Utility\BitUtils.cs" />
|
||||
<Compile Include="Services\Core\ByteDataConverter.cs" />
|
||||
<Compile Include="Services\Monitoring\CallMetricsCollector.cs" />
|
||||
<Compile Include="Config\Base\AlarmDto.cs" />
|
||||
<Compile Include="Config\Base\CmdUriDto.cs" />
|
||||
<Compile Include="Config\Base\ConnectionDto.cs" />
|
||||
@@ -176,7 +202,7 @@
|
||||
<Compile Include="Config\Base\TCDataDto.cs" />
|
||||
<Compile Include="Config\Base\TimersDto.cs" />
|
||||
<Compile Include="Config\EnumConf.cs" />
|
||||
<Compile Include="Config\ExtToolConf.cs" />
|
||||
<Compile Include="Config\Special\ExtToolConf.cs" />
|
||||
<Compile Include="Config\IobConfTree.cs" />
|
||||
<Compile Include="Config\Mem\MemAreaDto.cs" />
|
||||
<Compile Include="Config\Special\ActionDto.cs" />
|
||||
@@ -188,41 +214,39 @@
|
||||
<Compile Include="Config\Special\StepActionDto.cs" />
|
||||
<Compile Include="DataModel\Fimat.cs" />
|
||||
<Compile Include="DataModel\UstdData.cs" />
|
||||
<Compile Include="DataQueue.cs" />
|
||||
<Compile Include="FileProcMan.cs" />
|
||||
<Compile Include="Services\Data\DataQueue.cs" />
|
||||
<Compile Include="Services\Files\FileProcMan.cs" />
|
||||
<Compile Include="DataModel\FluxData.cs" />
|
||||
<Compile Include="FtpActConf.cs" />
|
||||
<Compile Include="GenActConf.cs" />
|
||||
<Compile Include="IniFile.cs" />
|
||||
<Compile Include="IntConditionCheck.cs" />
|
||||
<Compile Include="BitConditionCheck.cs" />
|
||||
<Compile Include="Config\Special\FtpActConf.cs" />
|
||||
<Compile Include="Config\GenActConf.cs" />
|
||||
<Compile Include="Config\IniFile.cs" />
|
||||
<Compile Include="Services\Utility\IntConditionCheck.cs" />
|
||||
<Compile Include="Services\Core\BitConditionCheck.cs" />
|
||||
<Compile Include="CustomObj.cs" />
|
||||
<Compile Include="DataExport.cs" />
|
||||
<Compile Include="Eurom63.cs" />
|
||||
<Compile Include="Services\Data\DataExport.cs" />
|
||||
<Compile Include="iobRefreshedEventArgs.cs" />
|
||||
<Compile Include="IobWinStatus.cs" />
|
||||
<Compile Include="Iob\BaseObj.cs" />
|
||||
<Compile Include="Iob\Services\DataSerializer.cs" />
|
||||
<Compile Include="Iob\Services\HttpService.cs" />
|
||||
<Compile Include="Iob\Services\NetService.cs" />
|
||||
<Compile Include="Iob\Services\XmlDataSerializer.cs" />
|
||||
<Compile Include="JobTask2Exe.cs" />
|
||||
<Compile Include="MeasureUtils.cs" />
|
||||
<Compile Include="plcMemMapExt.cs" />
|
||||
<Compile Include="TimerMan.cs" />
|
||||
<Compile Include="SingleThreadTaskScheduler.cs" />
|
||||
<Compile Include="TCMan.cs" />
|
||||
<Compile Include="TimeUtils.cs" />
|
||||
<Compile Include="ToMapo.cs" />
|
||||
<Compile Include="Services\Data\DataSerializer.cs" />
|
||||
<Compile Include="Services\Networking\HttpService.cs" />
|
||||
<Compile Include="Services\Networking\NetService.cs" />
|
||||
<Compile Include="Services\Data\XmlDataSerializer.cs" />
|
||||
<Compile Include="Services\Core\JobTask2Exe.cs" />
|
||||
<Compile Include="Services\Utility\MeasureUtils.cs" />
|
||||
<Compile Include="Config\Mem\plcMemMapExt.cs" />
|
||||
<Compile Include="Services\Core\TimerMan.cs" />
|
||||
<Compile Include="Services\Protocols\Eurom63.cs" />
|
||||
<Compile Include="Services\Core\SingleThreadTaskScheduler.cs" />
|
||||
<Compile Include="Services\Core\TCMan.cs" />
|
||||
<Compile Include="Services\Utility\TimeUtils.cs" />
|
||||
<Compile Include="Config\ToMapo.cs" />
|
||||
<Compile Include="baseUtils.cs" />
|
||||
<Compile Include="BinaryUtils.cs" />
|
||||
<Compile Include="Services\Core\BinaryUtils.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="fileMover.cs" />
|
||||
<Compile Include="Services\Files\FileMover.cs" />
|
||||
<Compile Include="Logging.cs" />
|
||||
<Compile Include="Objects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RedisIobCache.cs" />
|
||||
<Compile Include="utils.cs" />
|
||||
<Compile Include="Services\Files\utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ExtLib\krcc.dll" />
|
||||
|
||||
+440
-174
@@ -1,13 +1,23 @@
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Cache;
|
||||
using IOB_UT_NEXT.Services.Core;
|
||||
using IOB_UT_NEXT.Services.Data;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static IOB_UT_NEXT.BaseAlarmConf;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using static IOB_UT_NEXT.Config.BaseAlarmConf;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob
|
||||
{
|
||||
@@ -90,24 +100,14 @@ namespace IOB_UT_NEXT.Iob
|
||||
public bool doStartMemDump;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultimo avvio adapter
|
||||
/// Collettore di tutte le variabili scadenza DateTime
|
||||
/// </summary>
|
||||
public DateTime dtAvvioAdp = DateTime.Now;
|
||||
public DateTimeHelper DtHelp;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultimo spegnimento adapter
|
||||
/// Collettore di tutte le Queue gestite
|
||||
/// </summary>
|
||||
public DateTime dtStopAdp = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO check status IOB x evitare loop troppo stretti...
|
||||
/// </summary>
|
||||
public DateTime dtVetoCheckIOB = DateTime.Now.AddDays(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO check sync ricette x evitare loop troppo stretti...
|
||||
/// </summary>
|
||||
public DateTime dtVetoCheckSyncRecipe = DateTime.Now.AddHours(-1);
|
||||
public QueueHelper QHelp;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione lettura PrgName
|
||||
@@ -129,56 +129,11 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public IobConfTree IOBConfFull;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultima verifica CNC disconnesso...
|
||||
/// </summary>
|
||||
public DateTime lastDisconnCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultima volta che IOB è stato dichiarato online
|
||||
/// </summary>
|
||||
public DateTime lastIobOnline = DateTime.Now.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Ultima verifica status IOB x forzare display status SRV
|
||||
/// </summary>
|
||||
public DateTime lastIobStatusDisplUpdate = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo log periodico...
|
||||
/// </summary>
|
||||
public DateTime lastPeriodicLog;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo PING inviato verso il PLC...
|
||||
/// </summary>
|
||||
public DateTime lastPING = DateTime.Now.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima lettura da PLC
|
||||
/// </summary>
|
||||
public DateTime lastReadPLC;
|
||||
|
||||
/// <summary>
|
||||
/// ULtimo valore inviato (in caso di disconnessione lo reinvia x garantire watchdog...)
|
||||
/// </summary>
|
||||
public string lastSignInVal = "";
|
||||
|
||||
/// <summary>
|
||||
/// DateTime Ultimo valore simulazione generato
|
||||
/// </summary>
|
||||
public DateTime lastSim;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo segnale inviato al SERVER...
|
||||
/// </summary>
|
||||
public DateTime lastWatchDog;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo segnale inviato a macchina/PLC...
|
||||
/// </summary>
|
||||
public DateTime lastWatchDogPLC = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Massimo numero di px da inviare in blocco
|
||||
/// </summary>
|
||||
@@ -205,51 +160,6 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public bool procIotMem = false;
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori ALLARMI ove gestiti...
|
||||
/// </summary>
|
||||
public DataQueue QueueAlarm;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi letti di tipo FluxLog (e non ancora trasmessi)
|
||||
/// </summary>
|
||||
public DataQueue QueueFLog;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi letti (e non ancora trasmessi)
|
||||
/// </summary>
|
||||
public DataQueue QueueIN;
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori MESSAGGI/EVENTI (da non sottocampionare come samples)...
|
||||
/// </summary>
|
||||
public DataQueue QueueMessages;
|
||||
|
||||
/// <summary>
|
||||
/// Coda degli esiti di ping x calcolo stato macchina
|
||||
/// </summary>
|
||||
public DataQueue QueuePing;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi di tipo RawTransf (e non ancora trasmessi)
|
||||
/// NB: sono salvati serializzati come stringhe
|
||||
/// </summary>
|
||||
public DataQueue QueueRawTransf;// = new DataQueue("000", "QueueRawTransf", false);
|
||||
|
||||
/// <summary>
|
||||
/// Coda delle richieste dal server (Task2Exe)
|
||||
/// </summary>
|
||||
public DataQueue QueueSrvReq;
|
||||
|
||||
/// <summary>
|
||||
/// Coda delle risposte al server (Task2Exe)
|
||||
/// </summary>
|
||||
public DataQueue QueueSrvResp;
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori LOG UTENTE (da non sottocampionare come samples)...
|
||||
/// </summary>
|
||||
public DataQueue QueueULog;// = new DataQueue("000", "QueueULog", false);
|
||||
|
||||
/// <summary>
|
||||
/// alias booleano false = R
|
||||
@@ -276,37 +186,11 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public Stopwatch sw = new Stopwatch();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto gestione TempiCiclo e contapezzi
|
||||
/// </summary>
|
||||
public TCMan tcMan = new TCMan(0.5, 1.3, 5);
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto lettura dati (es per DB a 2 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoDataRead = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto SYNC dati (es per DB 2 DB a 10 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoDataSync = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Veto (in sec) a nuovi ping (x IOB PING, FTP...)
|
||||
/// </summary>
|
||||
public int vetoPingSec = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Veto specifico per la gestione (svuotamento) coda contapezzi (es in fase di attrezzaggio e reset lenti)
|
||||
/// Tipicamente impostato a DelayReadPzCountSetup dopo attrezzaggio...
|
||||
/// </summary>
|
||||
public DateTime vetoQueuePzCount = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto chiamata split (durante chiamata, per 60 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoSplit = DateTime.Now.AddMinutes(1);
|
||||
|
||||
/// <summary>
|
||||
/// alias booleano true = W
|
||||
/// </summary>
|
||||
@@ -326,33 +210,6 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public static bool DemoOut => utils.CRB("DemoOut");
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO PING a server sino alla data-ora indicata
|
||||
/// </summary>
|
||||
public static DateTime dtVetoPing
|
||||
{
|
||||
get => utils.dtVetoPing;
|
||||
set => utils.dtVetoPing = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO accodamento valori INGRESSI/EVENTI sino alla data-ora indicata
|
||||
/// </summary>
|
||||
public static DateTime dtVetoQueueIN
|
||||
{
|
||||
get => utils.dtVetoQueueIN;
|
||||
set => utils.dtVetoQueueIN = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO invio a server sino alla data-ora indicata
|
||||
/// </summary>
|
||||
public static DateTime dtVetoSend
|
||||
{
|
||||
get => utils.dtVetoSend;
|
||||
set => utils.dtVetoSend = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia abilitato test lettura blocchi memoria all'avvio
|
||||
/// </summary>
|
||||
@@ -398,18 +255,121 @@ namespace IOB_UT_NEXT.Iob
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Variabile numero errori vari (in lettura) --> se supera soglia maxErroriCheck --> disconnette
|
||||
/// </summary>
|
||||
protected static int numErroriCheck = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore di attesa (random) dopo ogni invio x evitare congestione send...
|
||||
/// </summary>
|
||||
protected static int urlRandWait = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Stato connessione con macchina gestita
|
||||
/// </summary>
|
||||
protected bool _connOk = false;
|
||||
|
||||
/// <summary>
|
||||
/// valore booleano di check se sia in fase di COMUNICAZIONE ATTIVA con il PLC/NC
|
||||
/// </summary>
|
||||
protected bool adpCommAct;
|
||||
|
||||
/// <summary>
|
||||
/// porta x adapter (x restart)
|
||||
/// </summary>
|
||||
protected int adpPortNum;
|
||||
|
||||
/// <summary>
|
||||
/// Vettore 32 BIT valori in ingresso al filtro
|
||||
/// </summary>
|
||||
protected int B_input;
|
||||
|
||||
/// <summary>
|
||||
/// Vettore 32 BIT valori in uscita dal filtro
|
||||
/// </summary>
|
||||
protected int B_output;
|
||||
|
||||
/// <summary>
|
||||
/// Vettore 32 BIT valori precedenti
|
||||
/// </summary>
|
||||
protected int B_previous = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Cod grupo IOB x creazione PODL al volo
|
||||
/// </summary>
|
||||
protected string CodGruppoIob = "ND-00";
|
||||
|
||||
/// <summary>
|
||||
/// Num errori check alive
|
||||
/// </summary>
|
||||
protected int currAliveErrors = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario valori impostati x produzione
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> currProdData = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// num corrente errori read PLC
|
||||
/// </summary>
|
||||
protected int currReadErrors = 0;
|
||||
|
||||
/// <summary>
|
||||
/// num errori send
|
||||
/// </summary>
|
||||
protected int currSendErrors = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo di attesa in minuti x lettura contapezzi standard (da .ini / OptPar)
|
||||
/// </summary>
|
||||
protected double delayMinReadPzCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Fattore di demoltiplicazione dei DynData x ridurre campionamento
|
||||
/// </summary>
|
||||
protected int demFactDynData = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Disabilitazione gestione ODL (lettura e gestione)
|
||||
/// </summary>
|
||||
protected bool disableOdl = false;
|
||||
|
||||
/// <summary>
|
||||
/// Boolean x indicare contapezzi disabilitato forzatamente da IOB
|
||||
/// </summary>
|
||||
protected bool disablePzCountByIob = false;
|
||||
|
||||
/// <summary>
|
||||
/// Determina se sia prevista gestione PODL (creazione/avvio/chiusura) come Soitaab
|
||||
/// </summary>
|
||||
protected bool EnabelPodlManFull = false;
|
||||
|
||||
/// <summary>
|
||||
/// Abilita riscrittura memoria se trova differenze lettura/richiesti
|
||||
/// </summary>
|
||||
protected bool ENABLE_MEM_REWRITE = true;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione restart (da opt par...)
|
||||
/// </summary>
|
||||
protected bool enableCliRestart = false;
|
||||
|
||||
/// <summary>
|
||||
/// Boolean x indicare contapezzi abilitato a livello di conf applicazione
|
||||
/// </summary>
|
||||
protected bool enablePzCountByApp = true;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione invio dataitem
|
||||
/// </summary>
|
||||
protected bool enableSendDataItem = true;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione gestione slow data
|
||||
/// </summary>
|
||||
protected bool enableSlowData = false;
|
||||
|
||||
//protected static Logger lg = LogManager.GetCurrentClassLogger();
|
||||
/// <summary>
|
||||
/// Abilitazione invio conf macchine
|
||||
@@ -417,30 +377,226 @@ namespace IOB_UT_NEXT.Iob
|
||||
protected bool enabSendMachineConf = true;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo LOG registrazione avvio (x ridurre log notturni...)
|
||||
/// dizionario (opzionale) xz decodifica file da importare
|
||||
/// </summary>
|
||||
protected DateTime lastLogStartup = DateTime.Today.AddHours(-1);
|
||||
protected Dictionary<string, int> FileDecod = new Dictionary<string, int>();
|
||||
|
||||
/// <summary>
|
||||
/// DeadBand x riduzione dati FluxLog (se 0 non gestita)
|
||||
/// </summary>
|
||||
protected double fluxLogRedDeadBand = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Determina se sia gestita riduzione dati FluxLog
|
||||
/// </summary>
|
||||
protected bool fluxLogReduce = false;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei valori FluxLog ultimi verificati x veto
|
||||
/// </summary>
|
||||
protected Dictionary<string, double> fluxLogReduceLast = new Dictionary<string, double>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei valori FluxLog ultimi tipo STRING verificati x veto
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> fluxLogReduceLastString = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei veto send x ogni variabile quando non variata
|
||||
/// </summary>
|
||||
protected Dictionary<string, DateTime> fluxLogReduceVeto = new Dictionary<string, DateTime>();
|
||||
|
||||
/// <summary>
|
||||
/// Finestra in minuti x invio dati FluxLog quando invariati
|
||||
/// </summary>
|
||||
protected int fluxLogResendPeriod = 60;
|
||||
|
||||
/// <summary>
|
||||
/// indica che è richiesto forzatamente reset contapezzi
|
||||
/// </summary>
|
||||
protected bool forcePzReset = false;
|
||||
|
||||
/// <summary>
|
||||
/// DEADBAND globale se impostata (es x gestire variazioni minime valori FluxLog da inviare...)
|
||||
/// </summary>
|
||||
protected float GLOBAL_DBAND = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Determina se siano gestite le ricette
|
||||
/// </summary>
|
||||
protected bool hasRecipe = false;
|
||||
|
||||
/// <summary>
|
||||
/// Array dei contatori x segnali blinking
|
||||
/// </summary>
|
||||
protected int[] i_counters;
|
||||
|
||||
/// <summary>
|
||||
/// Indica impianto IN SETUP (fino a quando SMETTE di esserlo...)
|
||||
/// </summary>
|
||||
protected bool inSetup = false;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ULTIMI valori impostati x produzione
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> lastProdData = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ultimi valori (string) delle TSS
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> LastTSS = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ultimi valori (string) delle TSS
|
||||
/// </summary>
|
||||
protected Dictionary<string, DateTime> LastTSSSend = new Dictionary<string, DateTime>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ultimi valori (double) delle TSVC
|
||||
/// </summary>
|
||||
protected Dictionary<string, double> LastTSVC = new Dictionary<string, double>();
|
||||
|
||||
/// <summary>
|
||||
/// Separatore linea (tipicamente x commenti)
|
||||
/// </summary>
|
||||
protected string lineSep = "--------------------------";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco parametri calcolati da inviare alla macchina (es ricetta con traduzione, RAMA/TFT)
|
||||
/// </summary>
|
||||
protected List<objItem> list2Write = new List<objItem>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco delle eventuali condizioni di veto conditions attive
|
||||
/// </summary>
|
||||
protected List<string> ListVetoCond = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Num massimo di errori in funzionalità check alive
|
||||
/// </summary>
|
||||
protected int maxAliveErrors = utils.CRI("maxAliveErrors");
|
||||
|
||||
/// <summary>
|
||||
/// Soglia massima errori prima della disconnessione automatica in check
|
||||
/// </summary>
|
||||
protected int maxErroriCheck = utils.CRI("maxErroriCheck");
|
||||
|
||||
/// <summary>
|
||||
/// Quantità massima per singola ricetta (per determinare num ricette da inviare)
|
||||
/// </summary>
|
||||
protected int maxQtyPerFile = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Dimensione coda di ping x valutazione
|
||||
/// </summary>
|
||||
protected int maxQueuePing = 11;
|
||||
|
||||
/// <summary>
|
||||
/// Num massimo di errori di rete read (dal PLC)
|
||||
/// </summary>
|
||||
protected int maxReadErrors = utils.CRI("maxReadErrors");
|
||||
|
||||
/// <summary>
|
||||
/// Periodo massimo (in sec) per letture dati in mancanza di eventi di aggiornamento
|
||||
/// </summary>
|
||||
protected int MaxSecReload = 120;
|
||||
|
||||
/// <summary>
|
||||
/// Num massimodi errori di rete send al server
|
||||
/// </summary>
|
||||
protected int maxSendErrors = utils.CRI("maxSendErrors");
|
||||
|
||||
/// <summary>
|
||||
/// Numero massimo di tentativi x test ping preliminare
|
||||
/// </summary>
|
||||
protected int maxTryPing = 1;
|
||||
|
||||
protected string mem2trace = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tempo minimo ammissibile di risposta (es x errori ModBus che risponde troppo in fretta) in millisec
|
||||
/// </summary>
|
||||
protected int minRespTimeMs = 5;
|
||||
|
||||
protected int minVetoSendDataItem = 60;
|
||||
|
||||
/// <summary>
|
||||
/// indica se serva refresh parametri e quindi PLC...
|
||||
/// </summary>
|
||||
protected bool needRefresh = true;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se usare la parte numerica di un articolo come codice INT
|
||||
/// </summary>
|
||||
protected bool numArtCharTrim = false;
|
||||
|
||||
/// <summary>
|
||||
/// Timeout x ping al server
|
||||
/// </summary>
|
||||
protected int pingServerMsTimeout = utils.CRI("PingMsTimeout");
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ritardo minimo x invio contapezzi
|
||||
/// </summary>
|
||||
protected int pzCountDelay = 2500;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se resettare allarmi all'avvio e inviare il reset appena parte adapter
|
||||
/// </summary>
|
||||
protected bool resetAlarmOnStart = false;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di campionamento x refresh info
|
||||
/// </summary>
|
||||
protected int samplePeriod = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// MsSample Period base x campionamenti tpo OCP-UA
|
||||
/// </summary>
|
||||
protected int samplePeriodBase = 600;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario di VC da trattare come TimeSeries (con conf decodificata + processing successivo...)
|
||||
/// </summary>
|
||||
protected Dictionary<string, VCData> TSVC_Data = new Dictionary<string, VCData>();
|
||||
|
||||
/// <summary>
|
||||
/// Indica se usare archivio locale ricette vs scarico http/REST
|
||||
/// </summary>
|
||||
protected bool useLocalRecipe = true;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario di VARIABILI da trattare come eventi (da inviare quando cambiano oppure a
|
||||
/// scadenza periodo...)
|
||||
/// </summary>
|
||||
protected Dictionary<string, EVData> VarArray = new Dictionary<string, EVData>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei divieti di invio x ogni counter gestito
|
||||
/// </summary>
|
||||
protected Dictionary<string, DateTime> VetoCounterSend = new Dictionary<string, DateTime>();
|
||||
|
||||
/// <summary>
|
||||
/// Veto per registrazione completa log di startup (minuti)
|
||||
/// </summary>
|
||||
protected int vetoLogStartupDuration = 60;
|
||||
|
||||
/// <summary>
|
||||
/// Durata in secondi del divieto accodamento segnali IN alla fase di startup
|
||||
/// </summary>
|
||||
protected int vetoQueueIn = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di veto prima di invio nuova conferma dei valori write correnti, default ogni 5 min
|
||||
/// </summary>
|
||||
protected double vetoSendWriteUpsert = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo wathdog di default (2 sec se non specificato)
|
||||
/// </summary>
|
||||
protected int watchDogPeriod = 2;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
@@ -459,6 +615,88 @@ namespace IOB_UT_NEXT.Iob
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica file MAP (caso <paramref name="ByteNum" />.bit)
|
||||
/// </summary>
|
||||
/// <param name="linea"></param>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="ByteNum">indirizzo Byte: indirizzo di partenza memoria</param>
|
||||
/// <param name="memSize">dimensione singolo slot in byte</param>
|
||||
/// <param name="BitNum">indirizzo bit: numero riga x calcolo indice bit</param>
|
||||
/// <returns></returns>
|
||||
protected static otherData decodeBitData(string linea, char separator, int ByteNum, int memSize, int BitNum)
|
||||
{
|
||||
if (linea != null)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int shift = 0;
|
||||
try
|
||||
{
|
||||
shift = Convert.ToInt32(valori[0]) - 1;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
int resto = 0;
|
||||
Math.DivRem(BitNum, 8, out resto);
|
||||
string memAddr = string.Format("{0}.{1}", ByteNum + shift * memSize, resto);
|
||||
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica file MAP generico
|
||||
/// </summary>
|
||||
/// <param name="linea"></param>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="memPre"></param>
|
||||
/// <param name="baseAddr"></param>
|
||||
/// <param name="memSize"></param>
|
||||
/// <returns></returns>
|
||||
protected static otherData decodeOtherData(string linea, char separator, string memPre, int baseAddr, int memSize)
|
||||
{
|
||||
if (linea != null)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int shift = 0;
|
||||
try
|
||||
{
|
||||
shift = Convert.ToInt32(valori[0]) - 1;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
string memAddr = string.Format("{0}{1}", memPre, baseAddr + shift * memSize);
|
||||
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static long GetObjectSize(object genObj, bool isSerializable)
|
||||
{
|
||||
long result = 0;
|
||||
if (isSerializable)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var formatter = new BinaryFormatter();
|
||||
formatter.Serialize(stream, genObj);
|
||||
result = stream.Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string rawVal = System.Text.Json.JsonSerializer.Serialize(genObj, options);
|
||||
result = rawVal.Length;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se ci sia veto log attivo e gestisce casistiche
|
||||
/// </summary>
|
||||
@@ -556,6 +794,21 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
protected string GetWeekStatsKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:WeekStats");
|
||||
|
||||
/// <summary>
|
||||
/// Deserializza una stringa JSON in un oggetto.
|
||||
/// </summary>
|
||||
protected T JsonDeserialize<T>(string json) => DataSerializer.Deserialize<T>(json);
|
||||
|
||||
/// <summary>
|
||||
/// Serializza un oggetto in formato JSON.
|
||||
/// </summary>
|
||||
protected string JsonSerialize<T>(T obj) => DataSerializer.Serialize(obj);
|
||||
|
||||
/// <summary>
|
||||
/// Serializza un oggetto in formato JSON con opzioni serializzazione.
|
||||
/// </summary>
|
||||
protected string JsonSerialize<T>(T obj, Formatting reqFormat) => DataSerializer.Serialize(obj, reqFormat);
|
||||
|
||||
/// <summary>
|
||||
/// Imposta un valore nel hash dello stato dell'IOB.
|
||||
/// </summary>
|
||||
@@ -573,19 +826,28 @@ namespace IOB_UT_NEXT.Iob
|
||||
string codIob = IOBConfFull.General.FilenameIOB;
|
||||
bool useRedis = IOBConfFull.General.EnabRedisQue;
|
||||
// valutare se portare di nuovo in redis...
|
||||
QueueIN = new DataQueue(codIob, "QueueIN", useRedis, redisMan);
|
||||
QueueSrvResp = new DataQueue(codIob, "QueueServResp", useRedis, redisMan);
|
||||
QHelp.QueueIN = new DataQueue(codIob, "QueueIN", useRedis, redisMan);
|
||||
QHelp.QueueSrvResp = new DataQueue(codIob, "QueueServResp", useRedis, redisMan);
|
||||
// fix a NON redis
|
||||
QueueAlarm = new DataQueue(codIob, "QueueAlarm", false, redisMan);
|
||||
QueueFLog = new DataQueue(codIob, "QueueFLog", false, redisMan);
|
||||
//QueueFLog = new DataQueue(codIob, "QueueFLog", useRedis, redisMan);
|
||||
QueueMessages = new DataQueue(codIob, "QueueMessages", false, redisMan);
|
||||
QueuePing = new DataQueue(codIob, "QueuePing", false, redisMan);
|
||||
QueueRawTransf = new DataQueue(codIob, "QueueRawTransf", false, redisMan);
|
||||
QueueSrvReq = new DataQueue(codIob, "QueueServReq", false, redisMan);
|
||||
QueueULog = new DataQueue(codIob, "QueueULog", false, redisMan);
|
||||
QHelp.QueueAlarm = new DataQueue(codIob, "QueueAlarm", false, redisMan);
|
||||
QHelp.QueueFLog = new DataQueue(codIob, "QueueFLog", false, redisMan);
|
||||
QHelp.QueueMessages = new DataQueue(codIob, "QueueMessages", false, redisMan);
|
||||
QHelp.QueuePing = new DataQueue(codIob, "QueuePing", false, redisMan);
|
||||
QHelp.QueueRawTransf = new DataQueue(codIob, "QueueRawTransf", false, redisMan);
|
||||
QHelp.QueueSrvReq = new DataQueue(codIob, "QueueServReq", false, redisMan);
|
||||
QHelp.QueueULog = new DataQueue(codIob, "QueueULog", false, redisMan);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializza una stringa XML in un oggetto.
|
||||
/// </summary>
|
||||
protected T XmlDeserialize<T>(string xml) => XmlDataSerializer.Deserialize<T>(xml);
|
||||
|
||||
/// <summary>
|
||||
/// Serializza un oggetto in formato XML.
|
||||
/// </summary>
|
||||
protected string XmlSerialize<T>(T obj) => XmlDataSerializer.Serialize(obj);
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -595,7 +857,11 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
private static readonly Logger lg = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static Random rnd = new Random();
|
||||
private static readonly JsonSerializerOptions options = new JsonSerializerOptions
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.IgnoreCycles,
|
||||
WriteIndented = false // Optional: set to true for pretty-printing
|
||||
};
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe helper di tutti gli oggetti DateTime impiegati
|
||||
/// ...da validare...
|
||||
/// </summary>
|
||||
public class DateTimeHelper
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultimo avvio adapter x watchdog
|
||||
/// </summary>
|
||||
public DateTime adpStartRun;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultimo avvio adapter
|
||||
/// </summary>
|
||||
public DateTime AvvioAdp = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Veto x esecuzione task AutoDossier
|
||||
/// </summary>
|
||||
public DateTime dtVetoAutoDossier = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Veto x lettura contapezzi (in caso di autoODL con attesa reset ad esempio...)
|
||||
/// </summary>
|
||||
public DateTime dtVetoReadPzCount = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra x veto all'invio dataItem
|
||||
/// </summary>
|
||||
public DateTime dtVetoSenDataItem = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Veto x esecuzione Task2Exe troppo frequenti
|
||||
/// </summary>
|
||||
public DateTime dtVetoTask2Exe = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// indica che è richiesto forzatamente reset contapezzi
|
||||
/// </summary>
|
||||
public DateTime forcePzResetUntil = DateTime.Now.AddMinutes(-1);
|
||||
|
||||
/// <summary>
|
||||
/// ultimo tentativo connessione...
|
||||
/// </summary>
|
||||
public DateTime lastConnectTry;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultima verifica CNC disconnesso...
|
||||
/// </summary>
|
||||
public DateTime lastDisconnCheck;
|
||||
|
||||
/// <summary>
|
||||
/// ultimo controllo decremento eventi
|
||||
/// </summary>
|
||||
public DateTime lastEvCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultima volta che IOB è stato dichiarato online
|
||||
/// </summary>
|
||||
public DateTime lastIobOnline = DateTime.Now.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Ultima verifica status IOB x forzare display status SRV
|
||||
/// </summary>
|
||||
public DateTime lastIobStatusDisplUpdate = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo LOG registrazione avvio (x ridurre log notturni...)
|
||||
/// </summary>
|
||||
public DateTime lastLogStartup = DateTime.Today.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo log periodico...
|
||||
/// </summary>
|
||||
public DateTime lastPeriodicLog;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo PING inviato verso il PLC...
|
||||
/// </summary>
|
||||
public DateTime lastPING = DateTime.Now.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo controllo ping x evitare ping flood...
|
||||
/// </summary>
|
||||
public DateTime lastPingConn = DateTime.Now.AddMinutes(-10);
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo invio contapezzi (x invio delayed)
|
||||
/// </summary>
|
||||
public DateTime lastPzCountSend;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima lettura da PLC
|
||||
/// </summary>
|
||||
public DateTime lastReadPLC;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo istante in cui sono stati ridotti dati simulazione duration
|
||||
/// </summary>
|
||||
public DateTime lastRedDuration;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime Ultimo valore simulazione generato
|
||||
/// </summary>
|
||||
public DateTime lastSim;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo istante in cui sono stati generati dati di simulazione
|
||||
/// </summary>
|
||||
public DateTime lastSimData;
|
||||
|
||||
/// <summary>
|
||||
/// Ultima registrazione warning x ODL mancante (x scrivere solo ogni 15 secondi)
|
||||
/// </summary>
|
||||
public DateTime lastWarnODL;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo segnale inviato al SERVER...
|
||||
/// </summary>
|
||||
public DateTime lastWatchDog;
|
||||
|
||||
/// <summary>
|
||||
/// dataOra ultimo segnale inviato a macchina/PLC...
|
||||
/// </summary>
|
||||
public DateTime lastWatchDogPLC = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// ultima data-ora invio parametri write x ribadire status
|
||||
/// </summary>
|
||||
public DateTime lastWriteParamsUpsert = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra avvio Programma x check avvio
|
||||
/// </summary>
|
||||
public DateTime prgStarted = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Data/ora ultimo spegnimento adapter
|
||||
/// </summary>
|
||||
public DateTime StopAdp = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO check status IOB x evitare loop troppo stretti...
|
||||
/// </summary>
|
||||
public DateTime VetoCheckIOB = DateTime.Now.AddDays(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO check sync ricette x evitare loop troppo stretti...
|
||||
/// </summary>
|
||||
public DateTime VetoCheckSyncRecipe = DateTime.Now.AddHours(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto lettura dati (es per DB a 2 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoDataRead = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto SYNC dati (es per DB 2 DB a 10 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoDataSync = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Veto specifico per la gestione (svuotamento) coda contapezzi (es in fase di attrezzaggio e reset lenti)
|
||||
/// Tipicamente impostato a DelayReadPzCountSetup dopo attrezzaggio...
|
||||
/// </summary>
|
||||
public DateTime vetoQueuePzCount = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Imposta veto chiamata split (durante chiamata, per 60 sec)
|
||||
/// </summary>
|
||||
public DateTime vetoSplit = DateTime.Now.AddMinutes(1);
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using IOB_UT_NEXT.Services.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe helper di tutti gli oggetti Queue impiegati
|
||||
/// ...da validare...
|
||||
/// </summary>
|
||||
public class QueueHelper
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori ALLARMI ove gestiti...
|
||||
/// </summary>
|
||||
public DataQueue QueueAlarm;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi letti di tipo FluxLog (e non ancora trasmessi)
|
||||
/// </summary>
|
||||
public DataQueue QueueFLog;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi letti (e non ancora trasmessi)
|
||||
/// </summary>
|
||||
public DataQueue QueueIN;
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori MESSAGGI/EVENTI (da non sottocampionare come samples)...
|
||||
/// </summary>
|
||||
public DataQueue QueueMessages;
|
||||
|
||||
/// <summary>
|
||||
/// Coda degli esiti di ping x calcolo stato macchina
|
||||
/// </summary>
|
||||
public DataQueue QueuePing;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto della coda degli elementi di tipo RawTransf (e non ancora trasmessi)
|
||||
/// NB: sono salvati serializzati come stringhe
|
||||
/// </summary>
|
||||
public DataQueue QueueRawTransf;
|
||||
|
||||
/// <summary>
|
||||
/// Coda delle richieste dal server (Task2Exe)
|
||||
/// </summary>
|
||||
public DataQueue QueueSrvReq;
|
||||
|
||||
/// <summary>
|
||||
/// Coda delle risposte al server (Task2Exe)
|
||||
/// </summary>
|
||||
public DataQueue QueueSrvResp;
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori LOG UTENTE (da non sottocampionare come samples)...
|
||||
/// </summary>
|
||||
public DataQueue QueueULog;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Services.Cache;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using NLog;
|
||||
|
||||
namespace IOB_UT_NEXT.Services.Networking
|
||||
{
|
||||
/// <summary>
|
||||
/// Orchestratore delle comunicazioni.
|
||||
/// Coordina HttpService e RedisIobCache per eseguire workflow di business.
|
||||
/// Riduce la profondità dello stack in Generic.cs.
|
||||
/// </summary>
|
||||
public class CommunicationService
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public CommunicationService(IobConfTree config, RedisIobCache redisMan)
|
||||
{
|
||||
_config = config;
|
||||
_redisMan = redisMan;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una chiamata HTTP e salva il risultato direttamente su Redis (Workflow orchestrato).
|
||||
/// </summary>
|
||||
public async Task<string> CallAndSaveToRedisAsync(string url, string redisKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
string result = await HttpService.CallUrlAsync(url);
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
_redisMan.setRSV(redisKey, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"Error in CallAndSaveToRedisAsync: URL={url}, Key={redisKey}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera dati da una URL e li deserializza (Workflow orchestrato).
|
||||
/// </summary>
|
||||
public async Task<T> GetAndDeserializeAsync<T>(string url)
|
||||
{
|
||||
string raw = await HttpService.CallUrlAsync(url);
|
||||
return IOB_UT_NEXT.Services.Data.DataSerializer.Deserialize<T>(raw);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una chiamata POST e salva il payload/risposta (Workflow orchestrato).
|
||||
/// </summary>
|
||||
public async Task<string> PostAndStoreAsync(string url, string payload, string redisKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
string response = await Task.Run(() => HttpService.CallUrlPost(url, payload));
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
{
|
||||
_redisMan.setRSV(redisKey, response);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"Error in PostAndStoreAsync: URL={url}, Key={redisKey}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IobConfTree _config;
|
||||
private readonly RedisIobCache _redisMan;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Core;
|
||||
using NLog;
|
||||
|
||||
namespace IOB_UT_NEXT.Services.Machine
|
||||
{
|
||||
/// <summary>
|
||||
/// MachineCommunicationService: Orchestratore per il dominio MACCHINA (_machineThread).
|
||||
/// Gestisce l'interazione con tcMan e memMap, incapsulando la logica di "maneggio" dei dati.
|
||||
/// </summary>
|
||||
public class MachineCommunicationService
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MachineCommunicationService(IobConfTree config, TCMan tcMan, plcMemMapExt memMap)
|
||||
{
|
||||
_config = config ?? throw new ArgumentNullException(nameof(config));
|
||||
_tcMan = tcMan ?? throw new ArgumentNullException(nameof(tcMan));
|
||||
_memMap = memMap ?? throw new ArgumentNullException(nameof(memMap));
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Ottiene la media dei tempi ciclo (TC) rilevati.
|
||||
/// </summary>
|
||||
public double GetAverageTc() => _tcMan.avgTC > 0 ? _tcMan.avgTC : 1.0;
|
||||
|
||||
/// <summary>
|
||||
/// Ottiene l'ultimo timestamp osservato dal PLC.
|
||||
/// </summary>
|
||||
public DateTime GetLastObservedData() => _tcMan.lastObservedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gestione conteggio pezzi attuale dal driver della macchina.
|
||||
/// </summary>
|
||||
///
|
||||
public int ContapezziIOB
|
||||
{
|
||||
get => _tcMan.pzCountIOB;
|
||||
set => _tcMan.pzCountIOB=value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione conteggio pezzi attuale dal PLC.
|
||||
/// </summary>
|
||||
public int ContapezziPLC
|
||||
{
|
||||
get => _tcMan.pzCountPLC;
|
||||
set => _tcMan.pzCountPLC = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione allarme in caso di TC superiore a soglia
|
||||
/// </summary>
|
||||
public bool AlarmDelayTC
|
||||
{
|
||||
get => _tcMan.alarmDelayTC;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legge un valore dalla memoria condivisa (MemMap) ricevuta dal PLC.
|
||||
/// </summary>
|
||||
public string ReadFromMemMap(string key)
|
||||
{
|
||||
if (_memMap != null && _memMap.mMapRead != null && _memMap.mMapRead.ContainsKey(key))
|
||||
{
|
||||
return _memMap.mMapRead[key].value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive un valore nella memoria condivisa (MemMap) per l'invio al PLC.
|
||||
/// </summary>
|
||||
public bool WriteToMemMap(string key, string value)
|
||||
{
|
||||
bool fatto = false;
|
||||
if (_memMap != null && _memMap.mMapWrite != null)
|
||||
{
|
||||
if (_memMap.mMapWrite.ContainsKey(key))
|
||||
{
|
||||
_memMap.mMapWrite[key].value = value;
|
||||
fatto = true;
|
||||
logger.Debug($"[MachineComm] MemMap Write: {key} = {value}");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Warn($"[MachineComm] Attempted write to non-existent MemMap key: {key}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IobConfTree _config;
|
||||
private readonly plcMemMapExt _memMap;
|
||||
private readonly TCMan _tcMan;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Services.Cache;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using IOB_UT_NEXT.Services.Data;
|
||||
using NLog;
|
||||
|
||||
namespace IOB_UT_NEXT.Services.Networking
|
||||
{
|
||||
/// <summary>
|
||||
/// ServerCommunicationService: Orchestratore per i task del dominio SERVER (_workerTask).
|
||||
/// Gestisce il coordinamento tra chiamate HTTP, persistenza Redis e code di comunicazione.
|
||||
/// </summary>
|
||||
public class ServerCommunicationService
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public ServerCommunicationService(IobConfTree config, RedisIobCache redisMan)
|
||||
{
|
||||
_config = config ?? throw new ArgumentNullException(nameof(config));
|
||||
_redisMan = redisMan ?? throw new ArgumentNullException(nameof(redisMan));
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una chiamata HTTP GET e deserializza il risultato.
|
||||
/// </summary>
|
||||
public async Task<T> GetAndDeserializeAsync<T>(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
string response = await HttpService.CallUrlAsync(url);
|
||||
return JsonDeserialize<T>(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"[ServerComm] Error in GetAndDeserializeAsync | URL: {url}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera dati da un URL e li salva su Redis.
|
||||
/// Workflow: HTTP GET -> Redis Set.
|
||||
/// </summary>
|
||||
public async Task<string> GetAndPersistAsync(string url, string redisKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
string response = await HttpService.CallUrlAsync(url);
|
||||
|
||||
if (!string.IsNullOrEmpty(response) && !string.IsNullOrEmpty(redisKey))
|
||||
{
|
||||
_redisMan.setRSV(redisKey, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"[ServerComm] Error in GetAndPersistAsync | URL: {url} | Key: {redisKey}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una chiamata HTTP POST e salva il risultato su Redis.
|
||||
/// Workflow: Serialize -> HTTP POST -> Redis Set.
|
||||
/// </summary>
|
||||
public async Task<string> PostAndPersistAsync<T>(string url, T payload, string redisKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
string serializedPayload = JsonSerialize(payload);
|
||||
logger.Debug($"[ServerComm] POST to {url} | Payload: {serializedPayload}");
|
||||
|
||||
string response = await HttpService.CallUrlAsync(url, serializedPayload);
|
||||
|
||||
if (!string.IsNullOrEmpty(response) && !string.IsNullOrEmpty(redisKey))
|
||||
{
|
||||
_redisMan.setRSV(redisKey, response);
|
||||
logger.Info($"[ServerComm] Data persisted to Redis: {redisKey}");
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"[ServerComm] Error in PostAndPersistAsync | URL: {url} | Key: {redisKey}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IobConfTree _config;
|
||||
private readonly RedisIobCache _redisMan;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private T JsonDeserialize<T>(string json) => IOB_UT_NEXT.Services.Data.DataSerializer.Deserialize<T>(json);
|
||||
|
||||
// Helper per mantenere la compatibilità con la logica di serializzazione esistente
|
||||
private string JsonSerialize<T>(T obj) => IOB_UT_NEXT.Services.Data.DataSerializer.Serialize(obj);
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,699 +0,0 @@
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
/// <summary>
|
||||
/// informazioni di produzione
|
||||
/// </summary>
|
||||
public struct prodData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public int AccTime;
|
||||
public bool EmrStop;
|
||||
public string FuncMode;
|
||||
public string MessageCode;
|
||||
public string MessageText;
|
||||
public string Operator;
|
||||
|
||||
public int Power;
|
||||
public bool Status;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione Endianness
|
||||
/// </summary>
|
||||
public static class Endian
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Scambia MSB/LSB per 16bit
|
||||
/// </summary>
|
||||
/// <param name="inValue"></param>
|
||||
/// <returns></returns>
|
||||
public static UInt16 SwapUInt16(UInt16 inValue)
|
||||
{
|
||||
return (UInt16)(((inValue & 0xff00) >> 8) |
|
||||
((inValue & 0x00ff) << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scambia MSB/LSB per 32bit
|
||||
/// </summary>
|
||||
/// <param name="inValue"></param>
|
||||
/// <returns></returns>
|
||||
public static UInt32 SwapUInt32(UInt32 inValue)
|
||||
{
|
||||
return ((inValue & 0xff000000) >> 24) |
|
||||
((inValue & 0x00ff0000) >> 8) |
|
||||
((inValue & 0x0000ff00) << 8) |
|
||||
((inValue & 0x000000ff) << 24);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco task di tipo FTP
|
||||
/// </summary>
|
||||
public class FtpTaskList
|
||||
{
|
||||
public List<FtpActConf> ListTask { get; set; } = new List<FtpActConf>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco task generici
|
||||
/// </summary>
|
||||
public class GenTaskList
|
||||
{
|
||||
public List<GenActConf> ListTask { get; set; } = new List<GenActConf>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione dati di timing
|
||||
/// </summary>
|
||||
public static class TimingData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static List<TimeRec> results = new List<TimeRec>();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// aggiorno vettore aggiungendo risultato
|
||||
/// </summary>
|
||||
/// <param name="caller">Codice chiamante</param>
|
||||
/// <param name="codice">Codice da registrare (univoco con chiamante)</param>
|
||||
/// <param name="ticks">Tempo esecuzione in ticks</param>
|
||||
public static void addResult(string caller, string codice, long ticks)
|
||||
{
|
||||
if (results.Count == 0)
|
||||
{
|
||||
results.Add(new TimeRec(caller, codice, ticks));
|
||||
}
|
||||
int indice = -1;
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
// se il codice è quello cercato...
|
||||
if (results[i].codCall == codice && results[i].classCall == caller)
|
||||
{
|
||||
indice = i;
|
||||
}
|
||||
}
|
||||
// se c'è aggiorno...
|
||||
if (indice >= 0)
|
||||
{
|
||||
results[indice].numCall++;
|
||||
results[indice].totMsec = results[indice].totMsec.Add(new TimeSpan(ticks));
|
||||
}
|
||||
// altrimenti aggiungo...
|
||||
else
|
||||
{
|
||||
results.Add(new TimeRec(caller, codice, ticks));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta i dati registrati (ad avvio adapter...)
|
||||
/// </summary>
|
||||
public static void resetData()
|
||||
{
|
||||
results = new List<TimeRec>();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cache a tempo valori INT
|
||||
/// </summary>
|
||||
public class CachedInt
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime ValidUntil { get; set; } = DateTime.Now;
|
||||
public int Value { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cache a tempo valori String
|
||||
/// </summary>
|
||||
public class CachedString
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime ValidUntil { get; set; } = DateTime.Now;
|
||||
public string Value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe conf x item DynData
|
||||
/// </summary>
|
||||
public class DynDataItem
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// DataOra scadenza invio forzato
|
||||
/// </summary>
|
||||
public DateTime DTScad = DateTime.Now;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore effettivo da salvare
|
||||
/// </summary>
|
||||
public string actVal { get; set; } = "";
|
||||
|
||||
public string func { get; set; } = "";
|
||||
public string key { get; set; } = "";
|
||||
public int maxVal { get; set; }
|
||||
public int minVal { get; set; }
|
||||
public string name { get; set; } = "";
|
||||
public int sPeriod { get; set; } = 60;
|
||||
public string unit { get; set; } = "";
|
||||
public string val { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione per Eventi/Variabili
|
||||
/// </summary>
|
||||
public class EVData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// DataOra scadenza invio forzato
|
||||
/// </summary>
|
||||
public DateTime DTScad = DateTime.Now;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "num";
|
||||
|
||||
/// <summary>
|
||||
/// Valore salvato
|
||||
/// </summary>
|
||||
public string Val { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco oggetti del monitoraggio (DynData, Status) per WPS
|
||||
/// </summary>
|
||||
public class MonitoredItemsConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<DynDataItem> DynData { get; set; }
|
||||
public srvData SrvData { get; set; }
|
||||
public List<StatusItem> Status { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe che contiene tutte le NUOVE informazioni da aggiornare sulla form
|
||||
/// </summary>
|
||||
public class newDisplayData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto COUTNER generico (pezzi, portata...)
|
||||
/// </summary>
|
||||
public int counter { get; set; } = -9999;
|
||||
|
||||
/// <summary>
|
||||
/// Bitmap attuale segnali letti
|
||||
/// </summary>
|
||||
public string currBitmap { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se contenga valori (NON default/empty)
|
||||
/// </summary>
|
||||
public bool hasData
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
// true se qualcosa NON E' come default
|
||||
if (!string.IsNullOrWhiteSpace(newInData) || !string.IsNullOrWhiteSpace(newSignalData) || !string.IsNullOrWhiteSpace(newFLogData) || !string.IsNullOrWhiteSpace(newUrlCallData) || !string.IsNullOrWhiteSpace(newLiveLogData) || counter > -9999 || !string.IsNullOrWhiteSpace(currBitmap) || semIn != Semaforo.ND || semOut != Semaforo.ND)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo FluxLog
|
||||
/// </summary>
|
||||
public string newFLogData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo IN (RAW)
|
||||
/// </summary>
|
||||
public string newInData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo LiveLog
|
||||
/// </summary>
|
||||
public string newLiveLogData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo Signal
|
||||
/// </summary>
|
||||
public string newSignalData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo UrlCall
|
||||
/// </summary>
|
||||
public string newUrlCallData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Stato semaforo IN verso PLC
|
||||
/// </summary>
|
||||
public Semaforo semIn { get; set; } = Semaforo.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Stato semaforo OUT verso MES
|
||||
/// </summary>
|
||||
public Semaforo semOut { get; set; } = Semaforo.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dato generico (per decodifica)
|
||||
/// </summary>
|
||||
public class otherData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public string codNum;
|
||||
public string dataType;
|
||||
public string memAddr;
|
||||
public string varName;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public otherData()
|
||||
{
|
||||
codNum = "";
|
||||
memAddr = "";
|
||||
varName = "";
|
||||
dataType = "";
|
||||
}
|
||||
|
||||
public otherData(string _codNum, string _memAddr, string _varName, string _dataType)
|
||||
{
|
||||
codNum = _codNum;
|
||||
memAddr = _memAddr;
|
||||
varName = _varName;
|
||||
dataType = _dataType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe gestione valori campionati su periodo
|
||||
/// </summary>
|
||||
public class sampleVect
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzo l'oggetto
|
||||
/// </summary>
|
||||
public sampleVect()
|
||||
{
|
||||
// init valori default...
|
||||
windSize = baseUtils.CRI("countWindSize") > 0 ? baseUtils.CRI("countWindSize") : 60;
|
||||
lTime = new List<DateTime>();
|
||||
lVal = new List<int>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Calcola il valore mediano...
|
||||
/// </summary>
|
||||
public double vcMedian
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
// restituisce la mediana SE valida, altrimenti null...
|
||||
if (numElem > 2 && flWindSize > windSize)
|
||||
{
|
||||
try
|
||||
{
|
||||
// calcolo mediana!
|
||||
//answ = Statistics.Median(lVal.ToArray());
|
||||
|
||||
// rif: https://blogs.msmvps.com/deborahk/linq-mean-median-and-mode/
|
||||
var sortedNumbers = lVal.OrderBy(n => n);
|
||||
int numCount = lVal.Count;
|
||||
int indice50 = lVal.Count / 2;
|
||||
if ((numCount % 2) == 0)
|
||||
{
|
||||
answ = ((sortedNumbers.ElementAt(indice50) + sortedNumbers.ElementAt(indice50 - 1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = sortedNumbers.ElementAt(indice50);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la vc sia valida (ovvero almeno 2 valori e intervallo > window richiesta)
|
||||
/// </summary>
|
||||
public bool vcValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return (flWindSize > windSize && numElem > 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge un valore alla serie ed eventualmente elimina i valori superflui a garantirne
|
||||
/// una finestra temporale valida
|
||||
/// </summary>
|
||||
/// <param name="tempo"></param>
|
||||
/// <param name="valore"></param>
|
||||
public void addValue(DateTime tempo, int valore)
|
||||
{
|
||||
lTime.Add(tempo);
|
||||
lVal.Add(valore);
|
||||
// verifico se siano da accorciare le serie... ovvero i 2 intervalli ENTRAMBI sono
|
||||
// superiori al periodo minimo (in tal caso riduco..
|
||||
while (flWindSize > windSize && slWindSize > windSize)
|
||||
{
|
||||
// elimino i 2 valori + vecchi
|
||||
lTime.RemoveAt(0);
|
||||
lVal.RemoveAt(0);
|
||||
// ora ricontrollo...
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// vettore valori temporali della serie
|
||||
/// </summary>
|
||||
protected List<DateTime> lTime;
|
||||
|
||||
/// <summary>
|
||||
/// vettore valori puntuali della serie
|
||||
/// </summary>
|
||||
protected List<int> lVal;
|
||||
|
||||
/// <summary>
|
||||
/// Dimensione finestra di campionamento (secondi)
|
||||
/// </summary>
|
||||
protected int windSize;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ampiezza finestra valori First-Last
|
||||
/// </summary>
|
||||
protected double flWindSize
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (numElem > 1)
|
||||
{
|
||||
answ = lTime.Last().Subtract(lTime[0]).TotalSeconds;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conteggio elementi
|
||||
/// </summary>
|
||||
protected int numElem
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
try
|
||||
{
|
||||
answ = lTime.Count;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ampiezza finestra valori Second-Last
|
||||
/// </summary>
|
||||
protected double slWindSize
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (numElem > 2) // altrimenti SE non ne ho almeno 3 NON posso avere secondo/ultimo...
|
||||
{
|
||||
answ = lTime.Last().Subtract(lTime[1]).TotalSeconds;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x descrivere status server MP
|
||||
/// </summary>
|
||||
public class ServerMpStatus
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// IP server
|
||||
/// </summary>
|
||||
public string IP { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima comunicazione OUT (con MP Server)
|
||||
/// </summary>
|
||||
public DateTime lastUpdate { get; set; } = DateTime.Now.AddDays(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Status del server
|
||||
/// </summary>
|
||||
public bool online { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe conf server html
|
||||
/// </summary>
|
||||
public class srvData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string baseUri { get; set; } = "";
|
||||
public string driverName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe conf x decodifica status
|
||||
/// </summary>
|
||||
public class StatusItem : DynDataItem
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public Dictionary<string, string> codeMapping;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto timing x archiviazione dati perfomances
|
||||
/// </summary>
|
||||
public class TimeRec
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe chiamante della funzione (es codice univoco IOB)
|
||||
/// </summary>
|
||||
public string classCall;
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte)
|
||||
/// </summary>
|
||||
public string codCall;
|
||||
|
||||
/// <summary>
|
||||
/// Num chiamate totale
|
||||
/// </summary>
|
||||
public int numCall;
|
||||
|
||||
/// <summary>
|
||||
/// Totale Msec accumulati
|
||||
/// </summary>
|
||||
public TimeSpan totMsec;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Classe record timing
|
||||
/// </summary>
|
||||
public TimeRec()
|
||||
{
|
||||
codCall = "";
|
||||
numCall = 0;
|
||||
totMsec = new TimeSpan(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe record timing
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="codice"></param>
|
||||
/// <param name="ticks"></param>
|
||||
public TimeRec(string caller, string codice, long nTicks)
|
||||
{
|
||||
classCall = caller;
|
||||
codCall = codice;
|
||||
numCall = 1;
|
||||
totMsec = new TimeSpan(nTicks);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tempo medio chiamata
|
||||
/// </summary>
|
||||
public double avgMsec
|
||||
{
|
||||
get
|
||||
{
|
||||
return totMsec.TotalMilliseconds / numCall;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione per Variabili Casuali
|
||||
/// </summary>
|
||||
public class VCData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Array dati per calcolo
|
||||
/// </summary>
|
||||
public List<double> dataArray;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inizio periodo di elaborazione
|
||||
/// </summary>
|
||||
public DateTime DTStart;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia di funzione da applicare
|
||||
/// </summary>
|
||||
public VC_func Funzione { get; set; } = VC_func.POINT;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di riferimento
|
||||
/// </summary>
|
||||
public int Period { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// UM parametro, impiegato anche x conversione (es epoch --> datetime)
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generico evento log
|
||||
/// </summary>
|
||||
public class GenLogRow
|
||||
{
|
||||
public DateTime dtRif { get; set; } = DateTime.Now;
|
||||
|
||||
public string valString { get; set; } = "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Informazioni generiche su batch produzione rilevati
|
||||
/// </summary>
|
||||
public class ProdBatchData
|
||||
{
|
||||
public DateTime dtStart { get; set; } = DateTime.Now;
|
||||
public DateTime? dtEnd { get; set; } = null;
|
||||
|
||||
public string codArt { get; set; } = "";
|
||||
public int numPz { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Cache a tempo valori INT
|
||||
/// </summary>
|
||||
public class CachedInt
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime ValidUntil { get; set; } = DateTime.Now;
|
||||
public int Value { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Cache a tempo valori String
|
||||
/// </summary>
|
||||
public class CachedString
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime ValidUntil { get; set; } = DateTime.Now;
|
||||
public string Value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe conf x item DynData
|
||||
/// </summary>
|
||||
public class DynDataItem
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// DataOra scadenza invio forzato
|
||||
/// </summary>
|
||||
public DateTime DTScad = DateTime.Now;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore effettivo da salvare
|
||||
/// </summary>
|
||||
public string actVal { get; set; } = "";
|
||||
|
||||
public string func { get; set; } = "";
|
||||
public string key { get; set; } = "";
|
||||
public int maxVal { get; set; }
|
||||
public int minVal { get; set; }
|
||||
public string name { get; set; } = "";
|
||||
public int sPeriod { get; set; } = 60;
|
||||
public string unit { get; set; } = "";
|
||||
public string val { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurazione per Eventi/Variabili
|
||||
/// </summary>
|
||||
public class EVData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// DataOra scadenza invio forzato
|
||||
/// </summary>
|
||||
public DateTime DTScad = DateTime.Now;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "num";
|
||||
|
||||
/// <summary>
|
||||
/// Valore salvato
|
||||
/// </summary>
|
||||
public string Val { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione Endianness
|
||||
/// </summary>
|
||||
public static class Endian
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Scambia MSB/LSB per 16bit
|
||||
/// </summary>
|
||||
/// <param name="inValue"></param>
|
||||
/// <returns></returns>
|
||||
public static UInt16 SwapUInt16(UInt16 inValue)
|
||||
{
|
||||
return (UInt16)(((inValue & 0xff00) >> 8) |
|
||||
((inValue & 0x00ff) << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scambia MSB/LSB per 32bit
|
||||
/// </summary>
|
||||
/// <param name="inValue"></param>
|
||||
/// <returns></returns>
|
||||
public static UInt32 SwapUInt32(UInt32 inValue)
|
||||
{
|
||||
return ((inValue & 0xff000000) >> 24) |
|
||||
((inValue & 0x00ff0000) >> 8) |
|
||||
((inValue & 0x0000ff00) << 8) |
|
||||
((inValue & 0x000000ff) << 24);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using IOB_UT_NEXT.Config.Special;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco task di tipo FTP
|
||||
/// </summary>
|
||||
public class FtpTaskList
|
||||
{
|
||||
public List<FtpActConf> ListTask { get; set; } = new List<FtpActConf>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Generico evento log
|
||||
/// </summary>
|
||||
public class GenLogRow
|
||||
{
|
||||
public DateTime dtRif { get; set; } = DateTime.Now;
|
||||
|
||||
public string valString { get; set; } = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using IOB_UT_NEXT.Config;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco task generici
|
||||
/// </summary>
|
||||
public class GenTaskList
|
||||
{
|
||||
public List<GenActConf> ListTask { get; set; } = new List<GenActConf>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco oggetti del monitoraggio (DynData, Status) per WPS
|
||||
/// </summary>
|
||||
public class MonitoredItemsConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<DynDataItem> DynData { get; set; }
|
||||
public srvData SrvData { get; set; }
|
||||
public List<StatusItem> Status { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Informazioni generiche su batch produzione rilevati
|
||||
/// </summary>
|
||||
public class ProdBatchData
|
||||
{
|
||||
public DateTime dtStart { get; set; } = DateTime.Now;
|
||||
public DateTime? dtEnd { get; set; } = null;
|
||||
|
||||
public string codArt { get; set; } = "";
|
||||
public int numPz { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe x descrivere status server MP
|
||||
/// </summary>
|
||||
public class ServerMpStatus
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// IP server
|
||||
/// </summary>
|
||||
public string IP { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima comunicazione OUT (con MP Server)
|
||||
/// </summary>
|
||||
public DateTime lastUpdate { get; set; } = DateTime.Now.AddDays(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Status del server
|
||||
/// </summary>
|
||||
public bool online { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe conf x decodifica status
|
||||
/// </summary>
|
||||
public class StatusItem : DynDataItem
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public Dictionary<string, string> codeMapping;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Oggetto timing x archiviazione dati perfomances
|
||||
/// </summary>
|
||||
public class TimeRec
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe chiamante della funzione (es codice univoco IOB)
|
||||
/// </summary>
|
||||
public string classCall;
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte)
|
||||
/// </summary>
|
||||
public string codCall;
|
||||
|
||||
/// <summary>
|
||||
/// Num chiamate totale
|
||||
/// </summary>
|
||||
public int numCall;
|
||||
|
||||
/// <summary>
|
||||
/// Totale Msec accumulati
|
||||
/// </summary>
|
||||
public TimeSpan totMsec;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Classe record timing
|
||||
/// </summary>
|
||||
public TimeRec()
|
||||
{
|
||||
codCall = "";
|
||||
numCall = 0;
|
||||
totMsec = new TimeSpan(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe record timing
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="codice"></param>
|
||||
/// <param name="ticks"></param>
|
||||
public TimeRec(string caller, string codice, long nTicks)
|
||||
{
|
||||
classCall = caller;
|
||||
codCall = codice;
|
||||
numCall = 1;
|
||||
totMsec = new TimeSpan(nTicks);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tempo medio chiamata
|
||||
/// </summary>
|
||||
public double avgMsec
|
||||
{
|
||||
get
|
||||
{
|
||||
return totMsec.TotalMilliseconds / numCall;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione dati di timing
|
||||
/// </summary>
|
||||
public static class TimingData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static List<TimeRec> results = new List<TimeRec>();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// aggiorno vettore aggiungendo risultato
|
||||
/// </summary>
|
||||
/// <param name="caller">Codice chiamante</param>
|
||||
/// <param name="codice">Codice da registrare (univoco con chiamante)</param>
|
||||
/// <param name="ticks">Tempo esecuzione in ticks</param>
|
||||
public static void addResult(string caller, string codice, long ticks)
|
||||
{
|
||||
if (results.Count == 0)
|
||||
{
|
||||
results.Add(new TimeRec(caller, codice, ticks));
|
||||
}
|
||||
int indice = -1;
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
// se il codice è quello cercato...
|
||||
if (results[i].codCall == codice && results[i].classCall == caller)
|
||||
{
|
||||
indice = i;
|
||||
}
|
||||
}
|
||||
// se c'è aggiorno...
|
||||
if (indice >= 0)
|
||||
{
|
||||
results[indice].numCall++;
|
||||
results[indice].totMsec = results[indice].totMsec.Add(new TimeSpan(ticks));
|
||||
}
|
||||
// altrimenti aggiungo...
|
||||
else
|
||||
{
|
||||
results.Add(new TimeRec(caller, codice, ticks));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta i dati registrati (ad avvio adapter...)
|
||||
/// </summary>
|
||||
public static void resetData()
|
||||
{
|
||||
results = new List<TimeRec>();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurazione per Variabili Casuali
|
||||
/// </summary>
|
||||
public class VCData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Array dati per calcolo
|
||||
/// </summary>
|
||||
public List<double> dataArray;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inizio periodo di elaborazione
|
||||
/// </summary>
|
||||
public DateTime DTStart;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia di funzione da applicare
|
||||
/// </summary>
|
||||
public VC_func Funzione { get; set; } = VC_func.POINT;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di riferimento
|
||||
/// </summary>
|
||||
public int Period { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// UM parametro, impiegato anche x conversione (es epoch --> datetime)
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using MapoSDK;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe che contiene tutte le NUOVE informazioni da aggiornare sulla form
|
||||
/// </summary>
|
||||
public class newDisplayData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto COUTNER generico (pezzi, portata...)
|
||||
/// </summary>
|
||||
public int counter { get; set; } = -9999;
|
||||
|
||||
/// <summary>
|
||||
/// Bitmap attuale segnali letti
|
||||
/// </summary>
|
||||
public string currBitmap { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se contenga valori (NON default/empty)
|
||||
/// </summary>
|
||||
public bool hasData
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
// true se qualcosa NON E' come default
|
||||
if (!string.IsNullOrWhiteSpace(newInData) || !string.IsNullOrWhiteSpace(newSignalData) || !string.IsNullOrWhiteSpace(newFLogData) || !string.IsNullOrWhiteSpace(newUrlCallData) || !string.IsNullOrWhiteSpace(newLiveLogData) || counter > -9999 || !string.IsNullOrWhiteSpace(currBitmap) || semIn != Semaforo.ND || semOut != Semaforo.ND)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo FluxLog
|
||||
/// </summary>
|
||||
public string newFLogData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo IN (RAW)
|
||||
/// </summary>
|
||||
public string newInData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo LiveLog
|
||||
/// </summary>
|
||||
public string newLiveLogData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo Signal
|
||||
/// </summary>
|
||||
public string newSignalData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dati tipo UrlCall
|
||||
/// </summary>
|
||||
public string newUrlCallData { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Stato semaforo IN verso PLC
|
||||
/// </summary>
|
||||
public Semaforo semIn { get; set; } = Semaforo.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Stato semaforo OUT verso MES
|
||||
/// </summary>
|
||||
public Semaforo semOut { get; set; } = Semaforo.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Dato generico (per decodifica)
|
||||
/// </summary>
|
||||
public class otherData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public string codNum;
|
||||
public string dataType;
|
||||
public string memAddr;
|
||||
public string varName;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public otherData()
|
||||
{
|
||||
codNum = "";
|
||||
memAddr = "";
|
||||
varName = "";
|
||||
dataType = "";
|
||||
}
|
||||
|
||||
public otherData(string _codNum, string _memAddr, string _varName, string _dataType)
|
||||
{
|
||||
codNum = _codNum;
|
||||
memAddr = _memAddr;
|
||||
varName = _varName;
|
||||
dataType = _dataType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// informazioni di produzione
|
||||
/// </summary>
|
||||
public struct prodData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public int AccTime;
|
||||
public bool EmrStop;
|
||||
public string FuncMode;
|
||||
public string MessageCode;
|
||||
public string MessageText;
|
||||
public string Operator;
|
||||
|
||||
public int Power;
|
||||
public bool Status;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe gestione valori campionati su periodo
|
||||
/// </summary>
|
||||
public class sampleVect
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzo l'oggetto
|
||||
/// </summary>
|
||||
public sampleVect()
|
||||
{
|
||||
// init valori default...
|
||||
windSize = baseUtils.CRI("countWindSize") > 0 ? baseUtils.CRI("countWindSize") : 60;
|
||||
lTime = new List<DateTime>();
|
||||
lVal = new List<int>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Calcola il valore mediano...
|
||||
/// </summary>
|
||||
public double vcMedian
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
// restituisce la mediana SE valida, altrimenti null...
|
||||
if (numElem > 2 && flWindSize > windSize)
|
||||
{
|
||||
try
|
||||
{
|
||||
// calcolo mediana!
|
||||
//answ = Statistics.Median(lVal.ToArray());
|
||||
|
||||
// rif: https://blogs.msmvps.com/deborahk/linq-mean-median-and-mode/
|
||||
var sortedNumbers = lVal.OrderBy(n => n);
|
||||
int numCount = lVal.Count;
|
||||
int indice50 = lVal.Count / 2;
|
||||
if ((numCount % 2) == 0)
|
||||
{
|
||||
answ = ((sortedNumbers.ElementAt(indice50) + sortedNumbers.ElementAt(indice50 - 1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = sortedNumbers.ElementAt(indice50);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la vc sia valida (ovvero almeno 2 valori e intervallo > window richiesta)
|
||||
/// </summary>
|
||||
public bool vcValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return (flWindSize > windSize && numElem > 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge un valore alla serie ed eventualmente elimina i valori superflui a garantirne
|
||||
/// una finestra temporale valida
|
||||
/// </summary>
|
||||
/// <param name="tempo"></param>
|
||||
/// <param name="valore"></param>
|
||||
public void addValue(DateTime tempo, int valore)
|
||||
{
|
||||
lTime.Add(tempo);
|
||||
lVal.Add(valore);
|
||||
// verifico se siano da accorciare le serie... ovvero i 2 intervalli ENTRAMBI sono
|
||||
// superiori al periodo minimo (in tal caso riduco..
|
||||
while (flWindSize > windSize && slWindSize > windSize)
|
||||
{
|
||||
// elimino i 2 valori + vecchi
|
||||
lTime.RemoveAt(0);
|
||||
lVal.RemoveAt(0);
|
||||
// ora ricontrollo...
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// vettore valori temporali della serie
|
||||
/// </summary>
|
||||
protected List<DateTime> lTime;
|
||||
|
||||
/// <summary>
|
||||
/// vettore valori puntuali della serie
|
||||
/// </summary>
|
||||
protected List<int> lVal;
|
||||
|
||||
/// <summary>
|
||||
/// Dimensione finestra di campionamento (secondi)
|
||||
/// </summary>
|
||||
protected int windSize;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ampiezza finestra valori First-Last
|
||||
/// </summary>
|
||||
protected double flWindSize
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (numElem > 1)
|
||||
{
|
||||
answ = lTime.Last().Subtract(lTime[0]).TotalSeconds;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conteggio elementi
|
||||
/// </summary>
|
||||
protected int numElem
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
try
|
||||
{
|
||||
answ = lTime.Count;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ampiezza finestra valori Second-Last
|
||||
/// </summary>
|
||||
protected double slWindSize
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (numElem > 2) // altrimenti SE non ne ho almeno 3 NON posso avere secondo/ultimo...
|
||||
{
|
||||
answ = lTime.Last().Subtract(lTime[1]).TotalSeconds;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace IOB_UT_NEXT.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe conf server html
|
||||
/// </summary>
|
||||
public class srvData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string baseUri { get; set; } = "";
|
||||
public string driverName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using Newtonsoft.Json;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -6,7 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Cache
|
||||
{
|
||||
public class RedisIobCache
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
public class BinaryUtils : IFormatProvider, ICustomFormatter
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
public class BitConditionCheck
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace IOB_UT_NEXT
|
||||
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
public class ByteDataConverter
|
||||
{
|
||||
@@ -1,12 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe per gestione Job Task2Exe x una macchina
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
public class SingleThreadTaskScheduler : TaskScheduler, IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SingleThreadTaskScheduler(string threadName)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
_thread = new Thread(() =>
|
||||
{
|
||||
// Creiamo il contesto di sincronizzazione personalizzato
|
||||
SyncContext = new SingleThreadSynchronizationContext(this);
|
||||
SynchronizationContext.SetSynchronizationContext(SyncContext);
|
||||
tcs.SetResult(true);
|
||||
|
||||
foreach (var task in _tasks.GetConsumingEnumerable())
|
||||
{
|
||||
base.TryExecuteTask(task);
|
||||
}
|
||||
})
|
||||
{ IsBackground = true, Name = threadName };
|
||||
_thread.Start();
|
||||
tcs.Task.Wait(); // Aspetta che il thread sia pronto col suo contesto
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public override int MaximumConcurrencyLevel => 1;
|
||||
public SynchronizationContext SyncContext { get; private set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose() => _tasks.CompleteAdding();
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override IEnumerable<Task> GetScheduledTasks() => _tasks;
|
||||
|
||||
protected override void QueueTask(Task task) => _tasks.Add(task);
|
||||
|
||||
protected override bool TryExecuteTaskInline(Task task, bool prev)
|
||||
=> Thread.CurrentThread == _thread && base.TryExecuteTask(task);
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly BlockingCollection<Task> _tasks = new BlockingCollection<Task>();
|
||||
private readonly Thread _thread;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Classes
|
||||
|
||||
private class SingleThreadSynchronizationContext : SynchronizationContext
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SingleThreadSynchronizationContext(SingleThreadTaskScheduler sch) => _sch = sch;
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override void Post(SendOrPostCallback d, object state)
|
||||
=> Task.Factory.StartNew(() => d(state), CancellationToken.None, TaskCreationOptions.None, _sch);
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly SingleThreadTaskScheduler _sch;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
#endregion Private Classes
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// TCiclo management class
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe di gestione info Timer per esecuzione ordinata processi secondo priorità
|
||||
@@ -5,7 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Data
|
||||
{
|
||||
public class DataExport
|
||||
{
|
||||
@@ -1,10 +1,11 @@
|
||||
using StackExchange.Redis;
|
||||
using IOB_UT_NEXT.Services.Cache;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe gestione code, a seconda della conf come LIST redis o come concurrent queue in memoria
|
||||
+12
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob.Services
|
||||
namespace IOB_UT_NEXT.Services.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestisce tutte le operazioni di serializzazione e deserializzazione dei dati.
|
||||
@@ -23,6 +23,17 @@ namespace IOB_UT_NEXT.Iob.Services
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializza un oggetto in una stringa JSON utilizzando la cultura invariante.
|
||||
/// </summary>
|
||||
public static string Serialize<T>(T obj, Formatting reqFormat)
|
||||
{
|
||||
if (obj == null) return null;
|
||||
// Utilizzo di CultureInfo.InvariantCulture per garantire la coerenza dei formati (es. decimali)
|
||||
return JsonConvert.SerializeObject(obj, reqFormat);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deserializza una stringa JSON in un oggetto del tipo specificato.
|
||||
/// </summary>
|
||||
+1
-1
@@ -2,7 +2,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob.Services
|
||||
namespace IOB_UT_NEXT.Services.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestisce le operazioni di serializzazione e deserializzazione in formato XML.
|
||||
@@ -6,19 +6,19 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Files
|
||||
{
|
||||
/// <summary>
|
||||
/// Accesso in lettura e scrittura al filesystem per gestione files upload e download
|
||||
/// </summary>
|
||||
public class fileMover
|
||||
public class FileMover
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// versione statica (singleton) del'oggetto fileMover
|
||||
/// versione statica (singleton) del'oggetto FileMover
|
||||
/// </summary>
|
||||
public static fileMover obj = new fileMover();
|
||||
public static FileMover obj = new FileMover();
|
||||
|
||||
/// <summary>
|
||||
/// oggetto WebClient
|
||||
@@ -34,7 +34,7 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
/// <param name="_path"></param>
|
||||
/// <param name="_log">non serve +... x retrocompatibilit�...</param>
|
||||
public fileMover(string _path, string _log)
|
||||
public FileMover(string _path, string _log)
|
||||
{
|
||||
setDirs(_path);
|
||||
WebCli = new WebClient();
|
||||
@@ -43,7 +43,7 @@ namespace IOB_UT_NEXT
|
||||
/// <summary>
|
||||
/// metodo di avvio empty
|
||||
/// </summary>
|
||||
public fileMover()
|
||||
public FileMover()
|
||||
{
|
||||
WebCli = new WebClient();
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Files
|
||||
{
|
||||
public class FileProcMan
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Files
|
||||
{
|
||||
public class utils : IOB_UT_NEXT.baseUtils
|
||||
{
|
||||
@@ -12,50 +12,32 @@ namespace IOB_UT_NEXT
|
||||
/// <summary>
|
||||
/// folder archiviazione dati configurazione (DATA\CONF)
|
||||
/// </summary>
|
||||
public static string confDir
|
||||
{
|
||||
get => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataConfPath"));
|
||||
}
|
||||
public static string confDir => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataConfPath"));
|
||||
|
||||
/// <summary>
|
||||
/// folder archiviazione dati storici giornalieri (DATA\DAT)
|
||||
/// </summary>
|
||||
public static string dataDatDir
|
||||
{
|
||||
get => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataDatPath"));
|
||||
}
|
||||
public static string dataDatDir => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataDatPath"));
|
||||
|
||||
/// <summary>
|
||||
/// folder archiviazione dati (DATA)
|
||||
/// </summary>
|
||||
public static string dataDir
|
||||
{
|
||||
get => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataPath"));
|
||||
}
|
||||
public static string dataDir => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("dataPath"));
|
||||
|
||||
/// <summary>
|
||||
/// File icona default
|
||||
/// </summary>
|
||||
public static string defIconFilePath
|
||||
{
|
||||
get => Path.Combine(utils.resxDir, "SteamWare.ico");
|
||||
}
|
||||
public static string defIconFilePath => Path.Combine(utils.resxDir, "SteamWare.ico");
|
||||
|
||||
/// <summary>
|
||||
/// File configurazione default x MAIN
|
||||
/// </summary>
|
||||
public static string mainConfFilePath
|
||||
{
|
||||
get=> Path.Combine(utils.confDir, utils.CRS("mainConfFile"));
|
||||
}
|
||||
public static string mainConfFilePath => Path.Combine(utils.confDir, utils.CRS("mainConfFile"));
|
||||
|
||||
/// <summary>
|
||||
/// folder archiviazione dati configurazione (DATA\CONF)
|
||||
/// </summary>
|
||||
public static string resxDir
|
||||
{
|
||||
get => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("resxPath"));
|
||||
}
|
||||
public static string resxDir => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CRS("resxPath"));
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Monitoring
|
||||
{
|
||||
public static class CallMetricsCollector
|
||||
{
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob.Services
|
||||
namespace IOB_UT_NEXT.Services.Networking
|
||||
{
|
||||
/// <summary>
|
||||
/// Servizio dedicato alla gestione delle chiamate HTTP.
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT.Iob.Services
|
||||
namespace IOB_UT_NEXT.Services.Networking
|
||||
{
|
||||
public class NetService
|
||||
{
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Protocols
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe di helper per metodi Euromap63 tramite File Exchange
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Utility
|
||||
{
|
||||
public class BitUtils
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Utility
|
||||
{
|
||||
public class IntConditionCheck
|
||||
{
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Utility
|
||||
{
|
||||
public class MeasureUtils
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
namespace IOB_UT_NEXT.Services.Utility
|
||||
{
|
||||
public class TimeUtils
|
||||
{
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class SingleThreadTaskScheduler : TaskScheduler, IDisposable
|
||||
{
|
||||
private readonly BlockingCollection<Task> _tasks = new BlockingCollection<Task>();
|
||||
private readonly Thread _thread;
|
||||
public SynchronizationContext SyncContext { get; private set; }
|
||||
|
||||
public SingleThreadTaskScheduler(string threadName)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
_thread = new Thread(() =>
|
||||
{
|
||||
// Creiamo il contesto di sincronizzazione personalizzato
|
||||
SyncContext = new SingleThreadSynchronizationContext(this);
|
||||
SynchronizationContext.SetSynchronizationContext(SyncContext);
|
||||
tcs.SetResult(true);
|
||||
|
||||
foreach (var task in _tasks.GetConsumingEnumerable())
|
||||
{
|
||||
base.TryExecuteTask(task);
|
||||
}
|
||||
})
|
||||
{ IsBackground = true, Name = threadName };
|
||||
_thread.Start();
|
||||
tcs.Task.Wait(); // Aspetta che il thread sia pronto col suo contesto
|
||||
}
|
||||
|
||||
private class SingleThreadSynchronizationContext : SynchronizationContext
|
||||
{
|
||||
private readonly SingleThreadTaskScheduler _sch;
|
||||
public SingleThreadSynchronizationContext(SingleThreadTaskScheduler sch) => _sch = sch;
|
||||
public override void Post(SendOrPostCallback d, object state)
|
||||
=> Task.Factory.StartNew(() => d(state), CancellationToken.None, TaskCreationOptions.None, _sch);
|
||||
}
|
||||
|
||||
protected override void QueueTask(Task task) => _tasks.Add(task);
|
||||
protected override bool TryExecuteTaskInline(Task task, bool prev)
|
||||
=> Thread.CurrentThread == _thread && base.TryExecuteTask(task);
|
||||
protected override IEnumerable<Task> GetScheduledTasks() => _tasks;
|
||||
public override int MaximumConcurrencyLevel => 1;
|
||||
public void Dispose() => _tasks.CompleteAdding();
|
||||
}
|
||||
+13
-10
@@ -1,3 +1,6 @@
|
||||
using IOB_UT_NEXT.Services.Core;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Monitoring;
|
||||
using NLog;
|
||||
using RestSharp;
|
||||
using System;
|
||||
@@ -412,12 +415,12 @@ namespace IOB_UT_NEXT
|
||||
public static void shrinkDir(string dirPath)
|
||||
{
|
||||
// obj filemover...
|
||||
fileMover.obj.setDirectory(dirPath);
|
||||
float dirSizeMb = fileMover.obj.totalMb();
|
||||
FileMover.obj.setDirectory(dirPath);
|
||||
float dirSizeMb = FileMover.obj.totalMb();
|
||||
lg.Info("Inizio shrinkDir LOG folder: {0} Mb", dirSizeMb);
|
||||
|
||||
// ottengo elenco files *.txt
|
||||
FileInfo[] _fis = fileMover.obj.elencoFiles_FI("*.log");
|
||||
FileInfo[] _fis = FileMover.obj.elencoFiles_FI("*.log");
|
||||
int numDdMax = 2;
|
||||
try
|
||||
{
|
||||
@@ -429,17 +432,17 @@ namespace IOB_UT_NEXT
|
||||
{
|
||||
if (_file.LastWriteTime < DateTime.Now.AddDays(-1)) // zippo files + vecchi di 2 gg...
|
||||
{
|
||||
fileMover.obj.zippaSingoloFile(_file);
|
||||
FileMover.obj.zippaSingoloFile(_file);
|
||||
// cancello l'originale...
|
||||
fileMover.obj.eliminaFile(_file);
|
||||
FileMover.obj.eliminaFile(_file);
|
||||
}
|
||||
}
|
||||
// inizio con eliminare file + vecchi della data indicata...
|
||||
int maxLogDays = CRI("maxLogDays");
|
||||
fileMover.obj.deleteOlderThan(maxLogDays);
|
||||
FileMover.obj.deleteOlderThan(maxLogDays);
|
||||
// ora controllo SE sia superata la dim max della directory --> in tal caso cancello dal
|
||||
// + vecchio...
|
||||
dirSizeMb = fileMover.obj.totalMb();
|
||||
dirSizeMb = FileMover.obj.totalMb();
|
||||
int maxLogDirSize = CRI("maxLogDirSize");
|
||||
int maxTry = 100;
|
||||
// controllo se serva eliminare...
|
||||
@@ -448,11 +451,11 @@ namespace IOB_UT_NEXT
|
||||
lg.Info("Continuo shrinkDir LOG folder: {0} Mb --> ELIMINAZIONE FILES", dirSizeMb);
|
||||
while (dirSizeMb > maxLogDirSize)
|
||||
{
|
||||
fileMover.obj.deleteOldest();
|
||||
FileMover.obj.deleteOldest();
|
||||
maxTry--;
|
||||
if (maxTry > 0)
|
||||
{
|
||||
dirSizeMb = fileMover.obj.totalMb();
|
||||
dirSizeMb = FileMover.obj.totalMb();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -460,7 +463,7 @@ namespace IOB_UT_NEXT
|
||||
dirSizeMb = maxLogDirSize - 1;
|
||||
}
|
||||
}
|
||||
dirSizeMb = fileMover.obj.totalMb();
|
||||
dirSizeMb = FileMover.obj.totalMb();
|
||||
lg.Info("Completata shrinkDir LOG folder: {0} Mb", dirSizeMb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using System;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
|
||||
+3
-3
@@ -53,17 +53,17 @@ namespace IOB_UT
|
||||
/// <summary>
|
||||
/// Indicazione VETO PING a server sino alla data-ora indicata
|
||||
/// </summary>
|
||||
public static DateTime dtVetoPing = DateTime.Now;
|
||||
public static DateTime DtHelp.dtVetoPing = DateTime.Now;
|
||||
#if false
|
||||
{
|
||||
get
|
||||
{
|
||||
return redisMan.servStatus.dtVetoPing;
|
||||
return redisMan.servStatus.DtHelp.dtVetoPing;
|
||||
}
|
||||
set
|
||||
{
|
||||
var currData = redisMan.servStatus;
|
||||
currData.dtVetoPing = value;
|
||||
currData.DtHelp.dtVetoPing = value;
|
||||
redisMan.servStatus = currData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace IOB_WIN_BECKHOFF
|
||||
/// <summary>
|
||||
/// carica IOB richiesto
|
||||
/// </summary>
|
||||
protected override void loadIobType()
|
||||
protected override async Task loadIobType()
|
||||
{
|
||||
if (IOBConfFull != null)
|
||||
{
|
||||
@@ -40,16 +40,11 @@ namespace IOB_WIN_BECKHOFF
|
||||
btnStart.Enabled = false;
|
||||
break;
|
||||
}
|
||||
lblCncText = $"CNC: {IOBConfFull.General.IobType} [{IOBConfFull.Device.Connect.IpAddr}:{IOBConfFull.Device.Connect.Port}]";
|
||||
lblSrvUrlText = $"SRV: {IOBConfFull.MapoMesConf.IpAddr} | URL: {IOBConfFull.MapoMesConf.ApiUrl("")}";
|
||||
|
||||
// aggancio evento refresh
|
||||
iobObj.eh_refreshed += IobObj_eh_refreshed;
|
||||
|
||||
// carico i default values su interfaccia
|
||||
setDefaults();
|
||||
|
||||
displayTaskAndLog($"Caricata conf per adapter {tipoScelto}");
|
||||
if (!await iobInitAsync())
|
||||
{
|
||||
return;
|
||||
}
|
||||
UpdateDisplTypeIobSel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+121
-113
@@ -1,178 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<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-FTP" />
|
||||
<add key="enableTest" value="false" />
|
||||
<add key="enableContapezzi" value="true" />
|
||||
<add key="enableMode" value="true" />
|
||||
<add key="enableOverrides" value="false" />
|
||||
<add key="enableTSVC" value="true" />
|
||||
<add key="enableDynData" value="false" />
|
||||
<add key="enableSysInfo" value="false" />
|
||||
<add key="enableAlarms" value="true" />
|
||||
<add key="doStartMemDump" value="false" />
|
||||
<add key="doSampleMemory" value="false" />
|
||||
<add key="basePrgMemPath" value="CNCMEMUSER" />
|
||||
<add key="pingMsTimeout" value="1500" />
|
||||
<add key="serverPingDisabled" value="false" />
|
||||
<add key="urlCallTOut" value="9999" />
|
||||
<add key="urlRandWait" value="200" />
|
||||
<add key="appName" value="IOB-WIN-FTP"/>
|
||||
<add key="enableTest" value="false"/>
|
||||
<add key="enableContapezzi" value="true"/>
|
||||
<add key="enableMode" value="true"/>
|
||||
<add key="enableOverrides" value="false"/>
|
||||
<add key="enableTSVC" value="true"/>
|
||||
<add key="enableDynData" value="false"/>
|
||||
<add key="enableSysInfo" value="false"/>
|
||||
<add key="enableAlarms" value="true"/>
|
||||
<add key="doStartMemDump" value="false"/>
|
||||
<add key="doSampleMemory" value="false"/>
|
||||
<add key="basePrgMemPath" value="CNCMEMUSER"/>
|
||||
<add key="pingMsTimeout" value="1500"/>
|
||||
<add key="serverPingDisabled" value="false"/>
|
||||
<add key="urlCallTOut" value="9999"/>
|
||||
<add key="urlRandWait" value="200"/>
|
||||
<!-- ciclo corto x invio a server: ms -->
|
||||
<add key="timerIntMs" value="10" />
|
||||
<add key="fastCount" value="20" />
|
||||
<add key="normCount" value="200" />
|
||||
<add key="slowCount" value="500" />
|
||||
<add key="verySlowCount" value="3000" />
|
||||
<add key="sampleMemCount" value="6000" />
|
||||
<add key="waitEndCycle" value="0" />
|
||||
<add key="comCheckTOut" value="10" />
|
||||
<add key="timerIntMs" value="10"/>
|
||||
<add key="fastCount" value="20"/>
|
||||
<add key="normCount" value="200"/>
|
||||
<add key="slowCount" value="500"/>
|
||||
<add key="verySlowCount" value="3000"/>
|
||||
<add key="sampleMemCount" value="6000"/>
|
||||
<add key="waitEndCycle" value="0"/>
|
||||
<add key="comCheckTOut" value="10"/>
|
||||
<!-- watchdog, ping, check disconnesso -->
|
||||
<add key="nMaxSend" value="10" />
|
||||
<add key="pingTestSec" value="5" />
|
||||
<add key="watchdogMaxSec" value="90" />
|
||||
<add key="disconMaxSec" value="30" />
|
||||
<add key="defIOB" value="2999" />
|
||||
<add key="pauseSendMSec" value="2000" />
|
||||
<add key="sendStartFLog" value="false" />
|
||||
<add key="nMaxSend" value="10"/>
|
||||
<add key="pingTestSec" value="5"/>
|
||||
<add key="watchdogMaxSec" value="90"/>
|
||||
<add key="disconMaxSec" value="30"/>
|
||||
<add key="defIOB" value="2999"/>
|
||||
<add key="pauseSendMSec" value="2000"/>
|
||||
<add key="sendStartFLog" value="false"/>
|
||||
<!--gestione coda-->
|
||||
<add key="maxQueueFLog" value="131072" />
|
||||
<add key="maxQueueRawTransf" value="1024" />
|
||||
<add key="maxQueueFLog" value="131072"/>
|
||||
<add key="maxQueueRawTransf" value="1024"/>
|
||||
<!--gestione max num errori-->
|
||||
<add key="maxAliveErrors" value="1000" />
|
||||
<add key="maxErroriCheck" value="300" />
|
||||
<add key="maxSendErrors" value="100" />
|
||||
<add key="maxReadErrors" value="20" />
|
||||
<add key="maxAliveErrors" value="1000"/>
|
||||
<add key="maxErroriCheck" value="300"/>
|
||||
<add key="maxSendErrors" value="100"/>
|
||||
<add key="maxReadErrors" value="20"/>
|
||||
<!--parametri SIM-->
|
||||
<add key="waitSimPar" value="180" />
|
||||
<add key="waitSimPar" value="180"/>
|
||||
|
||||
<!--gestione REDIS-->
|
||||
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" />
|
||||
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false" />
|
||||
<add key="redisDb" value="10" />
|
||||
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false"/>
|
||||
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false"/>
|
||||
<add key="redisDb" value="10"/>
|
||||
<!--gestione invio dati in blocchi Json-->
|
||||
<add key="minJsonData" value="2" />
|
||||
<add key="maxJsonData" value="100" />
|
||||
<add key="maxJsonDataEv" value="25" />
|
||||
<add key="minJsonData" value="2"/>
|
||||
<add key="maxJsonData" value="100"/>
|
||||
<add key="maxJsonDataEv" value="25"/>
|
||||
<!--gestione multithread-->
|
||||
<add key="sendDataByThread" value="false" />
|
||||
<add key="sendDataByThread" value="false"/>
|
||||
<!--Modalità DEMO: DemoOUT indica che NON invia davvero al server e DemoIN che simula e NON legge da PLC-->
|
||||
<add key="DemoIn" value="false" />
|
||||
<add key="DemoInSample" value="false" />
|
||||
<add key="DemoOut" value="false" />
|
||||
<add key="DemoIn" value="false"/>
|
||||
<add key="DemoInSample" value="false"/>
|
||||
<add key="DemoOut" value="false"/>
|
||||
<!--definizione invio dati molto variabili-->
|
||||
<add key="SendAxPos" value="false" />
|
||||
<add key="SendFeedSpeed" value="false" />
|
||||
<add key="SendAxPos" value="false"/>
|
||||
<add key="SendFeedSpeed" value="false"/>
|
||||
<!--Definizione avvio Adapter-->
|
||||
<add key="autoLoadConf" value="true" />
|
||||
<add key="autoStartOnLoad" value="true" />
|
||||
<add key="startMinimized" value="false" />
|
||||
<add key="windowCanMax" value="true" />
|
||||
<add key="trayClose" value="true" />
|
||||
<add key="autoSaveSec" value="60" />
|
||||
<add key="waitRecMSec" value="60000" />
|
||||
<add key="testCharSep" value="|" />
|
||||
<add key="delayShowLogMs" value="1000" />
|
||||
<add key="vetoSeconds" value="5" />
|
||||
<add key="autoLoadConf" value="true"/>
|
||||
<add key="autoStartOnLoad" value="true"/>
|
||||
<add key="startMinimized" value="false"/>
|
||||
<add key="windowCanMax" value="true"/>
|
||||
<add key="trayClose" value="true"/>
|
||||
<add key="autoSaveSec" value="60"/>
|
||||
<add key="waitRecMSec" value="60000"/>
|
||||
<add key="testCharSep" value="|"/>
|
||||
<add key="delayShowLogMs" value="1000"/>
|
||||
<add key="vetoSeconds" value="5"/>
|
||||
<!--conf file-->
|
||||
<add key="dataPath" value="DATA" />
|
||||
<add key="dataConfPath" value="DATA\CONF" />
|
||||
<add key="dataDatPath" value="DATA\DAT" />
|
||||
<add key="resxPath" value="Resources" />
|
||||
<add key="mainConfFile" value="MAIN.ini" />
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat" />
|
||||
<add key="dataPath" value="DATA"/>
|
||||
<add key="dataConfPath" value="DATA\CONF"/>
|
||||
<add key="dataDatPath" value="DATA\DAT"/>
|
||||
<add key="resxPath" value="Resources"/>
|
||||
<add key="mainConfFile" value="MAIN.ini"/>
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat"/>
|
||||
<!--<add key="simDataFile" value="SimData.dat" />-->
|
||||
<!--<add key="memDumpFile" value="MemoryDump.dat" />-->
|
||||
<add key="numSim" value="1" />
|
||||
<add key="AUpdAsAdm" value="true" />
|
||||
<add key="ConfToCloud" value="false" />
|
||||
<add key="CacheConfToCloudDuratHour" value="24" />
|
||||
<add key="numSim" value="1"/>
|
||||
<add key="AUpdAsAdm" value="true"/>
|
||||
<add key="ConfToCloud" value="false"/>
|
||||
<add key="CacheConfToCloudDuratHour" value="24"/>
|
||||
<!--logging-->
|
||||
<add key="recTime" value="true" />
|
||||
<add key="verbose" value="false" />
|
||||
<add key="logEvery" value="100" />
|
||||
<add key="zipLogOldDay" value="1" />
|
||||
<add key="maxLogDirSize" value="300" />
|
||||
<add key="maxLogDays" value="400" />
|
||||
<add key="numRowConsole" value="50" />
|
||||
<add key="verboseLogTOut" value="60" />
|
||||
<add key="recTime" value="true"/>
|
||||
<add key="verbose" value="false"/>
|
||||
<add key="logEvery" value="100"/>
|
||||
<add key="zipLogOldDay" value="1"/>
|
||||
<add key="maxLogDirSize" value="300"/>
|
||||
<add key="maxLogDays" value="400"/>
|
||||
<add key="numRowConsole" value="50"/>
|
||||
<add key="verboseLogTOut" value="60"/>
|
||||
<!--conf x FANUC-->
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="pzCountDelay" value="2000" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value=""/>
|
||||
<add key="pzCountDelay" value="2000"/>
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;libs" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<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" />
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<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" />
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<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" />
|
||||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<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" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
|
||||
</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" />
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<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" />
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<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" />
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<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" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2903.40" newVersion="1.0.2903.40" />
|
||||
<assemblyIdentity name="Microsoft.Web.WebView2.WinForms" publicKeyToken="2a8ab48044d2601e" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2903.40" newVersion="1.0.2903.40"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Web.WebView2.Core" publicKeyToken="2a8ab48044d2601e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2903.40" newVersion="1.0.2903.40" />
|
||||
<assemblyIdentity name="Microsoft.Web.WebView2.Core" publicKeyToken="2a8ab48044d2601e" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2903.40" newVersion="1.0.2903.40"/>
|
||||
</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" />
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<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" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="FluentFTP" publicKeyToken="f4af092b1d8df44f" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-53.0.2.0" newVersion="53.0.2.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>IOB_WIN_BECKHOFF</RootNamespace>
|
||||
<AssemblyName>IOB-WIN-BECKHOFF</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -33,8 +34,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</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="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -81,6 +82,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>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -27,8 +28,8 @@ namespace IOB_WIN_BECKHOFF.IobBeckhoff
|
||||
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
vetoCheckStatus = adesso;
|
||||
|
||||
// ora leggo il file di conf specifico....
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
+18
-26
@@ -8,10 +8,10 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace IOB_WIN_BECKHOFF.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace IOB_WIN_BECKHOFF.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@@ -19,51 +19,43 @@ namespace IOB_WIN_BECKHOFF.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_BECKHOFF.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
@@ -8,21 +8,17 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace IOB_WIN_BECKHOFF.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace IOB_WIN_BECKHOFF.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MapoSDK" version="6.14.2505.2916" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2509.1018" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.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="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net462" developmentDependency="true" requireReinstallation="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="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net462" requireReinstallation="true" />
|
||||
<package id="StackExchange.Redis" version="2.8.24" targetFramework="net462" requireReinstallation="true" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Diagnostics.PerformanceCounter" version="9.0.0" targetFramework="net462" />
|
||||
|
||||
+15
-14
@@ -2,7 +2,9 @@
|
||||
using EgwProxy.MultiCncLib.CNC;
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using NLog;
|
||||
using System;
|
||||
@@ -33,8 +35,8 @@ namespace IOB_WIN_FANUC.Iob
|
||||
|
||||
// gestione invio ritardato contapezzi
|
||||
|
||||
lastPzCountSend = DateTime.Now;
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
int gSize = 0;
|
||||
int rSize = 8;
|
||||
int xSize = 8;
|
||||
@@ -1525,14 +1527,14 @@ namespace IOB_WIN_FANUC.Iob
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("FANUC: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// ora PING!!!
|
||||
Ping pingSender = new Ping();
|
||||
IPAddress address = IPAddress.Loopback;
|
||||
@@ -1579,7 +1581,7 @@ namespace IOB_WIN_FANUC.Iob
|
||||
if (connectionOk)
|
||||
{
|
||||
checkVetoQueueIn();
|
||||
dtAvvioAdp = DateTime.Now;
|
||||
DtHelp.AvvioAdp = DateTime.Now;
|
||||
if (adpRunning)
|
||||
{
|
||||
lgInfo("Connessione OK");
|
||||
@@ -2585,10 +2587,10 @@ namespace IOB_WIN_FANUC.Iob
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
if (DateTime.Now.Subtract(DtHelp.lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2603,9 +2605,8 @@ namespace IOB_WIN_FANUC.Iob
|
||||
}
|
||||
// verifico NON sia vietato gestione contapezzi
|
||||
if (!plcPzCountValid)
|
||||
//if (!plcPzCountValid || !rawInputRead)
|
||||
{
|
||||
lgInfo($"Veto check contapezzi e ODL fino alle {dtVetoReadPzCount}");
|
||||
lgInfo($"Veto check contapezzi e ODL fino alle {DtHelp.dtVetoReadPzCount}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2614,7 +2615,7 @@ namespace IOB_WIN_FANUC.Iob
|
||||
{
|
||||
// controllo se è passato intervallo minimo tra 2
|
||||
// controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
// se sono differenti MOSTRO...
|
||||
if (contapezziPLC != contapezziIOB)
|
||||
@@ -2648,17 +2649,17 @@ namespace IOB_WIN_FANUC.Iob
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
lgInfo($"Attenzione: mancanza ODL non procedo con gestione contapezzi. contapezziPLC FANUC: {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Protocols;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -110,41 +111,6 @@ namespace IOB_WIN_FILE.IobFile
|
||||
// ciclo!
|
||||
try
|
||||
{
|
||||
#if false
|
||||
// controllo SE il driver SIA attivo...
|
||||
if (driver != null)
|
||||
{
|
||||
string cKey = "";
|
||||
string cVal = "";
|
||||
// IPOTESI: un UNICO oggetto decodifica status
|
||||
if (monitoredItems.Status.Count == 1)
|
||||
{
|
||||
var item = monitoredItems.Status[0];
|
||||
// cerco elemento indicato
|
||||
element = driver.FindElement(By.Id(item.val));
|
||||
cKey = element.Text;
|
||||
// verifico se mancasse il mapping...
|
||||
if (!item.codeMapping.ContainsKey(cKey))
|
||||
{
|
||||
processUnknStatus(cKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ora decodifico da variabile status a valore secondo impostazione "codeMapping"
|
||||
cVal = item.codeMapping[cKey];
|
||||
B_input = int.Parse(cVal, System.Globalization.NumberStyles.HexNumber);
|
||||
if (currDispData != null)
|
||||
{
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Errore: driver non pronto (null)");
|
||||
}
|
||||
#endif
|
||||
// riporto bitmap...
|
||||
reportRawInput(ref currDispData);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using EgwProxy.SqlDb.DbModels;
|
||||
#endif
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -70,7 +72,7 @@ namespace IOB_WIN_FILE.IobFile
|
||||
lgError($"Eccezione in IobFileSoitaab{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
lastPING = DateTime.Now.AddHours(-1);
|
||||
DtHelp.lastPING = DateTime.Now.AddHours(-1);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -87,7 +89,7 @@ namespace IOB_WIN_FILE.IobFile
|
||||
DateTime adesso = DateTime.Now;
|
||||
// NON fa nulla... anche se non dovrebbe richiamarlo
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ namespace IOB_WIN_FILE.IobFile
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
// processo ed accodo!
|
||||
processFluxLogTable(adesso);
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
return outVal;
|
||||
}
|
||||
|
||||
@@ -115,10 +117,10 @@ namespace IOB_WIN_FILE.IobFile
|
||||
if (connectionOk)
|
||||
{
|
||||
// controllo veto checkDB
|
||||
if (adesso > vetoDataRead)
|
||||
if (adesso > DtHelp.vetoDataRead)
|
||||
{
|
||||
// predispongo prox veto...
|
||||
vetoDataRead = adesso.AddSeconds(vetoReadFileSec);
|
||||
DtHelp.vetoDataRead = adesso.AddSeconds(vetoReadFileSec);
|
||||
// semaforo
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
// verifico SignLog e processo
|
||||
@@ -143,14 +145,14 @@ namespace IOB_WIN_FILE.IobFile
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("FileSoitaab: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
@@ -173,7 +175,7 @@ namespace IOB_WIN_FILE.IobFile
|
||||
if (adpRunning)
|
||||
{
|
||||
lgInfo($"Connessione OK alla folder {logDirPath}");
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -452,7 +454,7 @@ namespace IOB_WIN_FILE.IobFile
|
||||
if (queueInEnabCurr)
|
||||
{
|
||||
// --> accodo (valore già formattato)!
|
||||
QueueIN.Enqueue(currVal);
|
||||
QHelp.QueueIN.Enqueue(currVal);
|
||||
// loggo!
|
||||
lgTrace(string.Format("[QUEUE-IN] {0}", currVal));
|
||||
counterSigIN++;
|
||||
|
||||
+19
-15
@@ -1,7 +1,11 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Base;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Core;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Monitoring;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
@@ -781,7 +785,7 @@ namespace IOB_WIN_FORM
|
||||
if (sendStartFLog)
|
||||
{
|
||||
// segnalo reboot (programma)...
|
||||
iobObj.QueueFLog.Enqueue(iobObj.qEncodeFLog("IOB-STATUS", "IOB Adapter Started"));
|
||||
iobObj.QHelp.QueueFLog.Enqueue(iobObj.qEncodeFLog("IOB-STATUS", "IOB Adapter Started"));
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1744,7 +1748,7 @@ namespace IOB_WIN_FORM
|
||||
}
|
||||
else
|
||||
{
|
||||
lgTrace($"VETO DoExecMachineTasks.queueInEnabCurr | veto attivo | {adesso:yyyy.MM.dd HH:mm:ss}");
|
||||
lgTrace($"VETO DoExecMachineTasks.QueueINEnabCurr | veto attivo | {adesso:yyyy.MM.dd HH:mm:ss}");
|
||||
iobObj.checkVetoQueueIn();
|
||||
}
|
||||
}
|
||||
@@ -1805,7 +1809,7 @@ namespace IOB_WIN_FORM
|
||||
}
|
||||
else
|
||||
{
|
||||
lgTrace($"VETO DoExecServerTasksAsync.queueInEnabCurr | veto attivo | {adesso:yyyy.MM.dd HH:mm:ss}");
|
||||
lgTrace($"VETO DoExecServerTasksAsync.QueueINEnabCurr | veto attivo | {adesso:yyyy.MM.dd HH:mm:ss}");
|
||||
iobObj.checkVetoQueueIn();
|
||||
}
|
||||
}
|
||||
@@ -1963,7 +1967,7 @@ namespace IOB_WIN_FORM
|
||||
// out di cosa faccio...
|
||||
displayTaskAndLog($"[STARTUP] Loading ConfFile: {iniConfFile}");
|
||||
var appVers = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
string path = fileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory();
|
||||
string path = FileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory();
|
||||
string fileName = Path.GetFileName(iniConfFile).Replace(".ini", ".iob");
|
||||
string dirPath = Path.Combine(path, "DATA", "CONF_RUN");
|
||||
// verifica directory
|
||||
@@ -2137,19 +2141,19 @@ namespace IOB_WIN_FORM
|
||||
private void refreshFormData()
|
||||
{
|
||||
// aggiorno visualizzazioni varie in form...
|
||||
alQueueLen = iobObj.QueueAlarm.Count;
|
||||
evQueueLen = iobObj.QueueIN.Count;
|
||||
flQueueLen = iobObj.QueueFLog.Count;
|
||||
msQueueLen = iobObj.QueueMessages.Count;
|
||||
rtrQueueLen = iobObj.QueueRawTransf.Count;
|
||||
ulQueueLen = iobObj.QueueULog.Count;
|
||||
alQueueLen = iobObj.QHelp.QueueAlarm.Count;
|
||||
evQueueLen = iobObj.QHelp.QueueIN.Count;
|
||||
flQueueLen = iobObj.QHelp.QueueFLog.Count;
|
||||
msQueueLen = iobObj.QHelp.QueueMessages.Count;
|
||||
rtrQueueLen = iobObj.QHelp.QueueRawTransf.Count;
|
||||
ulQueueLen = iobObj.QHelp.QueueULog.Count;
|
||||
// aggiorno labels counters...
|
||||
counterIob = $"pz MES {iobObj.contapezziIOB}";
|
||||
counterMac = $"pz PLC {iobObj.contapezziPLC}";
|
||||
Dictionary<string, string> setPar = new Dictionary<string, string>();
|
||||
setPar.Add("IP", iobObj.IOBConfFull.Device.Connect.IpAddr);
|
||||
setPar.Add("PORT", iobObj.IOBConfFull.Device.Connect.Port);
|
||||
string note = $"{iobObj.IOBConfFull.General.FilenameIOB} | DT ultimo avvio: {iobObj.dtAvvioAdp}";
|
||||
string note = $"{iobObj.IOBConfFull.General.FilenameIOB} | DT ultimo avvio: {iobObj.DtHelp.AvvioAdp}";
|
||||
// verifico IOB status
|
||||
IobWinStatus currIobStatus = new IobWinStatus()
|
||||
{
|
||||
@@ -2163,10 +2167,10 @@ namespace IOB_WIN_FORM
|
||||
queueUlLen = ulQueueLen,
|
||||
counterIOB = iobObj.contapezziIOB,
|
||||
counterMAC = iobObj.contapezziPLC,
|
||||
lastUpdate = lastIobStatus.lastUpdate > iobObj.lastWatchDog ? lastIobStatus.lastUpdate : iobObj.lastWatchDog,
|
||||
lastUpdate = lastIobStatus.lastUpdate > iobObj.DtHelp.lastWatchDog ? lastIobStatus.lastUpdate : iobObj.DtHelp.lastWatchDog,
|
||||
online = utils.IOB_Online,
|
||||
lastDataIn = iobObj.lastReadPLC,
|
||||
lastDataOut = iobObj.lastIobOnline,
|
||||
lastDataIn = iobObj.DtHelp.lastReadPLC,
|
||||
lastDataOut = iobObj.DtHelp.lastIobOnline,
|
||||
setupParams = setPar,
|
||||
freeNotes = note
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -91,6 +92,9 @@
|
||||
<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.Resources.Extensions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Resources.Extensions.4.7.1\lib\net461\System.Resources.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using static IOB_UT_NEXT.BaseAlarmConf;
|
||||
|
||||
namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
@@ -245,13 +239,13 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = IOBConfFull.General.FilenameIOB;
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration)
|
||||
if (adesso.Subtract(DtHelp.lastLogStartup).TotalMinutes > vetoLogStartupDuration)
|
||||
{
|
||||
lg.Info(message);
|
||||
// se supera di 5 minutis cadenza -_> reimposto veto...
|
||||
if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration + 5)
|
||||
if (adesso.Subtract(DtHelp.lastLogStartup).TotalMinutes > vetoLogStartupDuration + 5)
|
||||
{
|
||||
lastLogStartup = adesso;
|
||||
DtHelp.lastLogStartup = adesso;
|
||||
}
|
||||
}
|
||||
if (sendToForm)
|
||||
@@ -274,13 +268,13 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = IOBConfFull.General.FilenameIOB;
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration)
|
||||
if (adesso.Subtract(DtHelp.lastLogStartup).TotalMinutes > vetoLogStartupDuration)
|
||||
{
|
||||
lg.Info(message, args);
|
||||
// se supera di 5 minutis cadenza -_> reimposto veto...
|
||||
if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration + 5)
|
||||
if (adesso.Subtract(DtHelp.lastLogStartup).TotalMinutes > vetoLogStartupDuration + 5)
|
||||
{
|
||||
lastLogStartup = adesso;
|
||||
DtHelp.lastLogStartup = adesso;
|
||||
}
|
||||
}
|
||||
sendToLogWatch("INFO", message, args);
|
||||
|
||||
+266
-796
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,8 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Data;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -28,19 +31,19 @@ namespace IOB_WIN_FORM.Iob
|
||||
lgInfo("NEW IobPing (WatchDog)");
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
vetoCheckStatus = adesso;
|
||||
// 2023.09.05 imposto anche primo ping e check disconnected...
|
||||
lastPING = adesso;
|
||||
lastDisconnCheck = adesso;
|
||||
DtHelp.lastPING = adesso;
|
||||
DtHelp.lastDisconnCheck = adesso;
|
||||
PoweroffTimeoutSec = IOBConfFull.Device.PoweroffTimeOutSec;
|
||||
// imposto i valori da inviare al controllo stato...
|
||||
bInOff = IOBConfFull.Special.PingConf.B_PowerOff;
|
||||
bInOn = IOBConfFull.Special.PingConf.B_PowerOn;
|
||||
vetoCheckSec = IOBConfFull.Special.PingConf.VetoCheckSec;
|
||||
// fix coda ping
|
||||
QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QueuePing", false, redisMan);
|
||||
QHelp.QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QHelp.QueuePing", false, redisMan);
|
||||
lgDebug($"L'adapter effettuera' PING di controllo all'indirizzo {IOBConfFull.Device.Connect.IpAddr} per forzare stato poweroff dopo {PoweroffTimeoutSec} sec");
|
||||
}
|
||||
|
||||
@@ -55,7 +58,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
// effettuo check ping!
|
||||
DateTime adesso = DateTime.Now;
|
||||
var lastCheck = lastPING < lastReadPLC ? lastReadPLC : lastReadPLC;
|
||||
var lastCheck = DtHelp.lastPING < DtHelp.lastReadPLC ? DtHelp.lastReadPLC : DtHelp.lastReadPLC;
|
||||
if (adesso.Subtract(lastCheck).TotalSeconds >= PoweroffTimeoutSec)
|
||||
{
|
||||
// gestione invio anche in caso di disconnessione
|
||||
@@ -75,8 +78,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
accodaSigIN(ref currDispData);
|
||||
// reset last ping...
|
||||
lastPING = DateTime.Now;
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,22 +96,22 @@ namespace IOB_WIN_FORM.Iob
|
||||
sw.Start();
|
||||
byte[] MemBlock = new byte[2];
|
||||
// faccio comunque ping se non ne ho collezionati a sufficienza...
|
||||
if (QueuePing.Count < maxQueuePing)
|
||||
if (QHelp.QueuePing.Count < maxQueuePing)
|
||||
{
|
||||
// in primis salvo data ping comunque...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// salvo esito ping
|
||||
bool pingOK = testPingMachine == IPStatus.Success;
|
||||
addTest(pingOK);
|
||||
}
|
||||
|
||||
if (adesso.Subtract(lastPING).TotalSeconds >= vetoCheckSec)
|
||||
if (adesso.Subtract(DtHelp.lastPING).TotalSeconds >= vetoCheckSec)
|
||||
{
|
||||
try
|
||||
{
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
// in primis salvo data ping comunque...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// salvo esito ping
|
||||
bool pingOK = testPingMachine == IPStatus.Success;
|
||||
addTest(pingOK);
|
||||
@@ -117,8 +120,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (pingStatusOk())
|
||||
{
|
||||
connectionOk = true;
|
||||
lastReadPLC = DateTime.Now;
|
||||
lastWatchDog = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastWatchDog = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -154,9 +157,9 @@ namespace IOB_WIN_FORM.Iob
|
||||
base.startAdapter(resetQueue);
|
||||
// 2023.09.05 imposto anche primo ping e check disconnected...
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastWatchDog = adesso;
|
||||
lastReadPLC = adesso;
|
||||
lastDisconnCheck = adesso;
|
||||
DtHelp.lastWatchDog = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
DtHelp.lastDisconnCheck = adesso;
|
||||
// faccio un primo check POST ritardo
|
||||
tryConnect();
|
||||
}
|
||||
@@ -171,7 +174,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (doLog)
|
||||
{
|
||||
@@ -179,7 +182,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
}
|
||||
lgDebug("PING: tryConnect step 04");
|
||||
|
||||
lgDebug("PING: Reset QueuePing");
|
||||
lgDebug("PING: Reset QHelp.QueuePing");
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
@@ -192,7 +195,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (pingStatusOk())
|
||||
{
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
connectionOk = true;
|
||||
queueInEnabCurr = true;
|
||||
lgInfo("PING OK");
|
||||
@@ -242,14 +245,14 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (B_input == 0 && pingOk)
|
||||
{
|
||||
B_input = bInOn;
|
||||
QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QueuePing", false, redisMan);
|
||||
lgTrace($"QueuePing resetted on addTest");
|
||||
QHelp.QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QHelp.QueuePing", false, redisMan);
|
||||
lgTrace($"QHelp.QueuePing resetted on addTest");
|
||||
}
|
||||
QueuePing.Enqueue($"{score}");
|
||||
while (QueuePing.Count > maxQueuePing)
|
||||
QHelp.QueuePing.Enqueue($"{score}");
|
||||
while (QHelp.QueuePing.Count > maxQueuePing)
|
||||
{
|
||||
string res = "";
|
||||
QueuePing.TryDequeue(out res);
|
||||
QHelp.QueuePing.TryDequeue(out res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,10 +265,10 @@ namespace IOB_WIN_FORM.Iob
|
||||
protected bool pingStatusOk()
|
||||
{
|
||||
bool answ = true;
|
||||
long numVal = QueuePing.Count;
|
||||
long numVal = QHelp.QueuePing.Count;
|
||||
if (numVal > maxQueuePing / 2)
|
||||
{
|
||||
var listaValori = QueuePing.ToList();
|
||||
var listaValori = QHelp.QueuePing.ToList();
|
||||
long numOk = listaValori.Where(x => x == "1").Count();
|
||||
long numKo = numVal - numOk;
|
||||
answ = numOk >= numKo;
|
||||
|
||||
+40
-81
@@ -1,6 +1,8 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -58,27 +60,22 @@ namespace IOB_WIN_FORM.Iob
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Private Fields for Dirty Check
|
||||
private int lastSentPzCount = -1;
|
||||
private DateTime lastBitmapDecodeTime = DateTime.MinValue;
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public Simula(AdapterForm caller, IobConfTree IobConfFull) : base(caller, IobConfFull)
|
||||
{
|
||||
// jitter di avvio per disallineare le istanze nella VM
|
||||
Random startRnd = new Random();
|
||||
int startDelay = startRnd.Next(0, 5000);
|
||||
int startDelay = startRnd.Next(0, 200);
|
||||
Thread.Sleep(startDelay);
|
||||
|
||||
// gestione invio ritardato contapezzi
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
lastEvCheck = adesso;
|
||||
lastSimData = adesso;
|
||||
lastRedDuration = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
DtHelp.lastEvCheck = adesso;
|
||||
DtHelp.lastSimData = adesso;
|
||||
DtHelp.lastRedDuration = adesso;
|
||||
// abilito subito scrittura coda IN
|
||||
queueInEnabCurr = true;
|
||||
// setup allarmi simulati
|
||||
@@ -93,13 +90,13 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
int basePeriod = 0;
|
||||
int.TryParse(IOBConfFull.OptParGet("PER_BASE"), out basePeriod);
|
||||
|
||||
|
||||
// Applicazione Jitter sui periodi per evitare sincronizzazione tra VM
|
||||
Random rnd = new Random();
|
||||
// Aggiungiamo un rumore del +/- 15% e un jitter extra
|
||||
double noiseFactor = 0.85 + (rnd.NextDouble() * 0.30);
|
||||
double noiseFactor = 0.85 + (rnd.NextDouble() * 0.30);
|
||||
periodoMSec = (int)(basePeriod * noiseFactor);
|
||||
|
||||
|
||||
// Assicuriamo un minimo di jitter per evitare che periodi simili si allineino
|
||||
periodoMSec += rnd.Next(1, 500);
|
||||
}
|
||||
@@ -152,28 +149,6 @@ namespace IOB_WIN_FORM.Iob
|
||||
// simulazione processo FTP (Cimolai) - FIXME TODO DeleteME
|
||||
ProcessDataSync();
|
||||
}
|
||||
// carica conf
|
||||
try
|
||||
{
|
||||
// Invece di bloccare il costruttore con .GetAwaiter().GetResult(),
|
||||
// avviamo il carico in modo "fire-and-forget" controllato.
|
||||
// Questo evita il context switch pesante durante l'inizializzazione.
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await Simula_Load(adesso);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lgError($"Errore in Simula_Load (background): {ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lgError($"Errore nel lancio del task Simula_Load: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -402,7 +377,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
// valore non presente in vers default... se gestito fare override
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
// verificare periodo SIM parametri... se passato li invio altrimenti NO... FIX a 20 sec
|
||||
if (lastSimData.AddSeconds(waitSimPar) < DateTime.Now && memMap != null)
|
||||
if (DtHelp.lastSimData.AddSeconds(waitSimPar) < DateTime.Now && memMap != null)
|
||||
{
|
||||
Random rnd = new Random();
|
||||
// controllo conf memorie json (se ci sono...)
|
||||
@@ -484,7 +459,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
lastSimData = DateTime.Now;
|
||||
DtHelp.lastSimData = DateTime.Now;
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
@@ -519,8 +494,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
public override async Task InitializeAsync()
|
||||
{
|
||||
await Simula_Load(DateTime.Now);
|
||||
// attendo altri 50ms
|
||||
await Task.Delay(50);
|
||||
// attendo altri 10ms
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -546,7 +521,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
sendDataItemsList(demoItems);
|
||||
|
||||
// salvo lettura
|
||||
lastReadPLC = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
lgInfo($"Completato processCustomTaskLF");
|
||||
}
|
||||
|
||||
@@ -564,7 +539,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
var currOdl = CurrOdl();
|
||||
|
||||
// salvo lettura
|
||||
lastReadPLC = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
lgInfo($"Completato processCustomTaskMF");
|
||||
}
|
||||
|
||||
@@ -573,7 +548,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// </summary>
|
||||
public override void processVHF()
|
||||
{
|
||||
if (lastEvCheck.AddMilliseconds(periodoMSec) < DateTime.Now)
|
||||
if (DtHelp.lastEvCheck.AddMilliseconds(periodoMSec) < DateTime.Now)
|
||||
{
|
||||
// decremento contatore ultimo evento
|
||||
if (bit2 != null)
|
||||
@@ -596,7 +571,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
|
||||
if (simRS != null)
|
||||
simRS.wait--;
|
||||
lastEvCheck = DateTime.Now;
|
||||
DtHelp.lastEvCheck = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -792,21 +767,6 @@ namespace IOB_WIN_FORM.Iob
|
||||
|
||||
protected bool disableSimStatus = false;
|
||||
|
||||
/// <summary>
|
||||
/// ultimo controllo decremento eventi
|
||||
/// </summary>
|
||||
protected DateTime lastEvCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo istante in cui sono stati ridotti dati simulazione duration
|
||||
/// </summary>
|
||||
protected DateTime lastRedDuration;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo istante in cui sono stati generati dati di simulazione
|
||||
/// </summary>
|
||||
protected DateTime lastSimData;
|
||||
|
||||
/// <summary>
|
||||
/// Cartella logfile x test import (tipo Soitaab)
|
||||
/// </summary>
|
||||
@@ -971,9 +931,9 @@ namespace IOB_WIN_FORM.Iob
|
||||
item.reqValue = "";
|
||||
|
||||
MemBlock = new byte[byteSize];
|
||||
serObj = JsonConvert.SerializeObject(item, Formatting.Indented);
|
||||
serObj = JsonSerialize(item, Formatting.Indented);
|
||||
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}{Environment.NewLine}---------------UPDATED PARAM---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
serObj = JsonConvert.SerializeObject(currMem, Formatting.Indented);
|
||||
serObj = JsonSerialize(currMem, Formatting.Indented);
|
||||
lgInfo($"---------------MEMORY CONTENT---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
lgInfo($"---------------MemBlock data---------------{Environment.NewLine}{BitConverter.ToString(MemBlock)}{Environment.NewLine}--------------- END data ---------------");
|
||||
|
||||
@@ -1000,12 +960,12 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
// Eseguiamo il lavoro in un Task per non bloccare il thread chiamante,
|
||||
// Eseguiamo il lavoro in un Task per non bloccare il thread chiamante,
|
||||
// ma evitiamo il .GetAwaiter().GetResult() che causerebbe un blocco sincrono pesante.
|
||||
// In un ambiente WinForms, questo permette al thread di polling di non restare in attesa attiva.
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
// Esecuzione dei task sincroni esistenti
|
||||
iobWriteLocalCSV();
|
||||
@@ -1049,7 +1009,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
string autoOdlRes = HttpService.CallUrl(urlFixDailyOdl);
|
||||
|
||||
// salvo lettura
|
||||
lastReadPLC = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
lgInfo($"Completato processSlowDataRead");
|
||||
return answ;
|
||||
}
|
||||
@@ -1060,7 +1020,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="bit2proc"></param>
|
||||
protected void tryRedDuration(int bit2proc)
|
||||
{
|
||||
if (lastRedDuration.AddMilliseconds(periodoMSec / 20) < DateTime.Now)
|
||||
if (DtHelp.lastRedDuration.AddMilliseconds(periodoMSec / 20) < DateTime.Now)
|
||||
{
|
||||
switch (bit2proc)
|
||||
{
|
||||
@@ -1091,7 +1051,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lastRedDuration = DateTime.Now;
|
||||
DtHelp.lastRedDuration = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,9 +1060,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
#region Private Fields
|
||||
|
||||
private List<string> alarmMessages = new List<string>();
|
||||
|
||||
private int currSimAlarmCode = 0;
|
||||
|
||||
private DateTime lastBitmapDecodeTime = DateTime.MinValue;
|
||||
private Random rnd = new Random();
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -1457,7 +1416,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
}
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
// provo a fare split ODL...
|
||||
@@ -1473,7 +1432,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bit5 != null && bit5.wait <= 0 || tcMan.alarmDelayTC)
|
||||
else if (bit5 != null && bit5.wait <= 0 || machineCommService.AlarmDelayTC)
|
||||
{
|
||||
// segnalo BIT
|
||||
B_input += (1 << 5);
|
||||
@@ -1609,7 +1568,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
|
||||
listaArt = JsonDeserialize<List<AnagArticoli>>(rawListArt);
|
||||
okArt = listaArt.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1625,7 +1584,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
|
||||
listaDoss = JsonDeserialize<List<DossiersModel>>(rawListDOSS);
|
||||
okDoss = listaDoss.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1641,7 +1600,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
|
||||
listaPODL = JsonDeserialize<List<PODLModel>>(rawListPODL);
|
||||
okPodl = listaPODL.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1657,7 +1616,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
anagLVFasi = JsonConvert.DeserializeObject<List<ListVal>>(rawLVFasi);
|
||||
anagLVFasi = JsonDeserialize<List<ListVal>>(rawLVFasi);
|
||||
dictAF = anagLVFasi.ToDictionary(x => x.value, x => x.label);
|
||||
okLVFasi = listaArt.Count > 0;
|
||||
}
|
||||
@@ -1758,7 +1717,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaArt = JsonConvert.DeserializeObject<List<AnagArticoli>>(rawListArt);
|
||||
listaArt = JsonDeserialize<List<AnagArticoli>>(rawListArt);
|
||||
okArt = listaArt.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1774,7 +1733,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaDoss = JsonConvert.DeserializeObject<List<DossiersModel>>(rawListDOSS);
|
||||
listaDoss = JsonDeserialize<List<DossiersModel>>(rawListDOSS);
|
||||
okDoss = listaDoss.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1790,7 +1749,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
try
|
||||
{
|
||||
listaPODL = JsonConvert.DeserializeObject<List<PODLModel>>(rawListPODL);
|
||||
listaPODL = JsonDeserialize<List<PODLModel>>(rawListPODL);
|
||||
okPodl = listaPODL.Count > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1826,7 +1785,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (selArt != null && selDoss != null)
|
||||
{
|
||||
// recupero il resultset dei valori FluxLog da caricare
|
||||
DossierFluxLogDTO resultSet = JsonConvert.DeserializeObject<DossierFluxLogDTO>(selDoss.Valore);
|
||||
DossierFluxLogDTO resultSet = JsonDeserialize<DossierFluxLogDTO>(selDoss.Valore);
|
||||
List<FluxLog> listFluxLog = resultSet.ODL;
|
||||
|
||||
// preparo elenco parametri da inviare...
|
||||
@@ -1974,7 +1933,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (queueInEnabCurr)
|
||||
{
|
||||
// --> accodo (valore già formattato)!
|
||||
QueueIN.Enqueue(currVal);
|
||||
QHelp.QueueIN.Enqueue(currVal);
|
||||
// loggo!
|
||||
lgDebug(string.Format("[QUEUE-IN] {0}", currVal));
|
||||
counterSigIN++;
|
||||
@@ -2165,7 +2124,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="dataItems"></param>
|
||||
private void sendDataItemsList(List<machDataItem> dataItems)
|
||||
{
|
||||
string rawData = JsonConvert.SerializeObject(dataItems);
|
||||
string rawData = JsonSerialize(dataItems);
|
||||
HttpService.CallUrlPost($"{urlSaveDataItems}", rawData);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using MathNet.Numerics.Distributions;
|
||||
using Newtonsoft.Json;
|
||||
@@ -845,7 +846,7 @@ namespace IOB_WIN_FORM
|
||||
// salvo!
|
||||
foreach (var item in objFiles.fileList)
|
||||
{
|
||||
fileMover.obj.salvaFileString(utils.confDir, item.fileName, item.content);
|
||||
FileMover.obj.salvaFileString(utils.confDir, item.fileName, item.content);
|
||||
}
|
||||
displayTaskAndLog("Download conf files aggiornati");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<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.Resources.Extensions" version="4.7.1" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
|
||||
<package id="System.Text.Encodings.Web" version="10.0.0" targetFramework="net472" />
|
||||
<package id="System.Text.Json" version="10.0.0" targetFramework="net472" />
|
||||
|
||||
+27
-24
@@ -1,6 +1,11 @@
|
||||
using EgwProxy.Ftp;
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.Config.Special;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Data;
|
||||
using IOB_UT_NEXT.Services.Utility;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -34,12 +39,12 @@ namespace IOB_WIN_FTP.Iob
|
||||
B_input = 0;
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
vetoCheckStatus = adesso;
|
||||
// 2023.09.05 imposto anche primo ping e check disconnected...
|
||||
lastPING = adesso;
|
||||
lastDisconnCheck = adesso;
|
||||
DtHelp.lastPING = adesso;
|
||||
DtHelp.lastDisconnCheck = adesso;
|
||||
var VETO_PING_SEC = getOptPar("VETO_PING_SEC");
|
||||
if (!string.IsNullOrEmpty(VETO_PING_SEC))
|
||||
{
|
||||
@@ -324,7 +329,7 @@ namespace IOB_WIN_FTP.Iob
|
||||
}
|
||||
}
|
||||
}
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -338,7 +343,7 @@ namespace IOB_WIN_FTP.Iob
|
||||
if (ftpClientMan.IsConfigured)
|
||||
{
|
||||
// salto se fosse attivo il veto ping...
|
||||
if (lastPING.AddSeconds(vetoPingSec) < adesso)
|
||||
if (DtHelp.lastPING.AddSeconds(vetoPingSec) < adesso)
|
||||
{
|
||||
// lo stato è come ping machine, x ora puntato a IP unico (WiFi?)
|
||||
byte[] MemBlock = new byte[2];
|
||||
@@ -346,7 +351,7 @@ namespace IOB_WIN_FTP.Iob
|
||||
{
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
// in primis salvo data ping comunque...
|
||||
lastPING = adesso;
|
||||
DtHelp.lastPING = adesso;
|
||||
|
||||
// salvo esito ping
|
||||
bool pingOK = testPingMachine == IPStatus.Success;
|
||||
@@ -407,8 +412,8 @@ namespace IOB_WIN_FTP.Iob
|
||||
connectionOk = true;
|
||||
}
|
||||
|
||||
lastReadPLC = adesso;
|
||||
lastWatchDog = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
DtHelp.lastWatchDog = adesso;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -439,10 +444,10 @@ namespace IOB_WIN_FTP.Iob
|
||||
base.startAdapter(resetQueue);
|
||||
// 2023.09.05 imposto anche primo ping e check disconnected...
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastWatchDog = adesso;
|
||||
//lastPING = adesso;
|
||||
lastReadPLC = adesso;
|
||||
lastDisconnCheck = adesso;
|
||||
DtHelp.lastWatchDog = adesso;
|
||||
//DtHelp.lastPING = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
DtHelp.lastDisconnCheck = adesso;
|
||||
// faccio un primo check POST ritardo
|
||||
tryConnect();
|
||||
}
|
||||
@@ -456,10 +461,8 @@ namespace IOB_WIN_FTP.Iob
|
||||
lgDebug($"FTP: tryConnect step 01 | connectionOk: {connectionOk}");
|
||||
if (!connectionOk)
|
||||
{
|
||||
//// resetto coda...
|
||||
//QueuePing = new DataQueue("000", "QueuePing", false);
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > vetoPingSec)
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > vetoPingSec)
|
||||
{
|
||||
if (doLog)
|
||||
{
|
||||
@@ -476,7 +479,7 @@ namespace IOB_WIN_FTP.Iob
|
||||
if (pingStatusOk())
|
||||
{
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
connectionOk = true;
|
||||
queueInEnabCurr = true;
|
||||
lgInfo("FTP - ping OK");
|
||||
@@ -641,14 +644,14 @@ namespace IOB_WIN_FTP.Iob
|
||||
if (B_input == 0 && pingOk)
|
||||
{
|
||||
B_input = 1;
|
||||
QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QueuePing", false, redisMan);
|
||||
lgTrace($"QueuePing resetted on addTest");
|
||||
QHelp.QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QHelp.QueuePing", false, redisMan);
|
||||
lgTrace($"QHelp.QueuePing resetted on addTest");
|
||||
}
|
||||
QueuePing.Enqueue($"{score}");
|
||||
while (QueuePing.Count > maxQueuePing)
|
||||
QHelp.QueuePing.Enqueue($"{score}");
|
||||
while (QHelp.QueuePing.Count > maxQueuePing)
|
||||
{
|
||||
string res = "";
|
||||
QueuePing.TryDequeue(out res);
|
||||
QHelp.QueuePing.TryDequeue(out res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,10 +941,10 @@ namespace IOB_WIN_FTP.Iob
|
||||
private bool pingStatusOk()
|
||||
{
|
||||
bool answ = false;
|
||||
long numVal = QueuePing.Count;
|
||||
long numVal = QHelp.QueuePing.Count;
|
||||
if (numVal > maxQueuePing / 2)
|
||||
{
|
||||
var listaValori = QueuePing.ToList();
|
||||
var listaValori = QHelp.QueuePing.ToList();
|
||||
long numOk = listaValori.Where(x => x == "1").Count();
|
||||
long numKo = numVal - numOk;
|
||||
answ = numOk >= numKo;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -21,8 +23,8 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
{
|
||||
// gestione invio ritardato contapezzi
|
||||
|
||||
lastPzCountSend = DateTime.Now;
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
// init connessione
|
||||
setConnection();
|
||||
|
||||
@@ -307,7 +309,7 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
// se trova ok thread o almeno kawasaki connesso --> aggiorno ultima lettura
|
||||
if (threadOk || KAWASAKI_ref.IsConnected)
|
||||
{
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -324,28 +326,6 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
{
|
||||
// impiego override metodo set...
|
||||
bool answ = setcontapezziPLC(0, codTav);
|
||||
#if false
|
||||
bool answ = false;
|
||||
// ...SE abilitato da conf IOB
|
||||
if (cIobConf.optPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
|
||||
{
|
||||
// scrivo valore 0 x il contapezzi
|
||||
try
|
||||
{
|
||||
pzCounter = 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in RESET contapezzi KAWASAKI");
|
||||
connectionOk = false;
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Impossibile effettuare RESET contapezzi KAWASAKI, mancanza parametro OPT:ENABLE_PZ_RESET");
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -386,14 +366,14 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("KAWASAKI: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
@@ -887,10 +867,10 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
if (DateTime.Now.Subtract(DtHelp.lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -909,7 +889,7 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
{
|
||||
// ora processo il contapezzi... controllo se è passato intervallo minimo tra 2
|
||||
// controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
// se sono differenti MOSTRO...
|
||||
if (contapezziPLC != contapezziIOB)
|
||||
@@ -944,7 +924,7 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -954,11 +934,11 @@ namespace IOB_WIN_KAWASAKI.Iob
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
lgError($"Attenzione: mancanza ODL non procedo con gestione contapezzi. contapezziPLC KAWASAKI {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using EasyModbus;
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Core;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Utility;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -41,8 +46,8 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
{
|
||||
// gestione invio ritardato contapezzi
|
||||
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
// inizializzo parametri...
|
||||
parametri = new ModBusTcpParamConf();
|
||||
#if false
|
||||
@@ -291,7 +296,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
}
|
||||
else
|
||||
{
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -507,7 +512,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgInfo("ModBus TCP: tryConnect step 03");
|
||||
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (doLog)
|
||||
{
|
||||
@@ -516,7 +521,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgInfo("ModBus TCP: tryConnect step 04");
|
||||
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
@@ -533,7 +538,6 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
// refresh stato allarmi!!!
|
||||
if (connectionOk)
|
||||
{
|
||||
//queueInEnabCurr = true;
|
||||
lgInfo($"Connessione OK: {connectionOk}");
|
||||
if (adpRunning)
|
||||
{
|
||||
@@ -595,7 +599,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
connectionOk = false;
|
||||
queueInEnabCurr = false;
|
||||
// resetto last ping...
|
||||
lastPING = DateTime.Now.AddMinutes(-1);
|
||||
DtHelp.lastPING = DateTime.Now.AddMinutes(-1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -673,10 +677,6 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
/// </summary>
|
||||
protected Dictionary<int, int[]> InputRegisterLUT = new Dictionary<int, int[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo controllo ping x evitare ping flood...
|
||||
/// </summary>
|
||||
protected DateTime lastPingConn = DateTime.Now.AddMinutes(-10);
|
||||
|
||||
/// <summary>
|
||||
/// Esito ultimo ping
|
||||
@@ -1177,7 +1177,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
if (!connectionOk)
|
||||
{
|
||||
// ora tento avvio PLC... SE PING OK...
|
||||
lastPING = adesso;
|
||||
DtHelp.lastPING = adesso;
|
||||
IPStatus esitoPing = testPingMachine;
|
||||
if (esitoPing == IPStatus.Success)
|
||||
{
|
||||
@@ -1374,7 +1374,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
{
|
||||
// riduco i controlli ping.. li faccio solo ogni 5 ping period se precedente positivo...
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (lastPingOk && adesso.Subtract(lastPingConn).TotalMilliseconds < 5 * parametri.pingMsTimeout)
|
||||
if (lastPingOk && adesso.Subtract(DtHelp.lastPingConn).TotalMilliseconds < 5 * parametri.pingMsTimeout)
|
||||
{
|
||||
answ = lastPingOk;
|
||||
}
|
||||
@@ -1420,7 +1420,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
}
|
||||
}
|
||||
// salvo stato ping
|
||||
lastPingConn = adesso;
|
||||
DtHelp.lastPingConn = adesso;
|
||||
}
|
||||
lastPingOk = answ;
|
||||
}
|
||||
@@ -2006,7 +2006,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgTrace($"Lettura in blocco Colis | startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {sw.ElapsedMilliseconds}ms");
|
||||
// salvo statistica...
|
||||
trackReadData(rawData.Length / 8, sw.Elapsed.TotalMilliseconds / 1000);
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
// salvo in LUT i dati...
|
||||
if (rawData.Length > 0)
|
||||
{
|
||||
@@ -2077,7 +2077,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgTrace($"Lettura in blocco DiscreteInput | startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {sw.ElapsedMilliseconds}ms");
|
||||
// salvo statistica...
|
||||
trackReadData(rawData.Length / 8, sw.Elapsed.TotalMilliseconds / 1000);
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
// salvo in LUT i dati...
|
||||
if (rawData.Length > 0)
|
||||
{
|
||||
@@ -2149,7 +2149,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgTrace($"Lettura in blocco HoldingRegisters| startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
// salvo statistica...
|
||||
trackReadData(rawData.Length * 2, sw.Elapsed.TotalMilliseconds / 1000);
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
// se risposta troppo rapida (< minRespTimeMs, tipicamente 5 msse non impostato in OptPar) indico NON ok e errori...
|
||||
if (sw.Elapsed.TotalMilliseconds < minRespTimeMs)
|
||||
{
|
||||
@@ -2240,7 +2240,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
lgTrace($"Lettura in blocco InputRegisters| startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {sw.ElapsedMilliseconds}ms");
|
||||
// salvo statistica...
|
||||
trackReadData(rawData.Length * 2, sw.Elapsed.TotalMilliseconds / 1000);
|
||||
lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
// salvo in LUT la versione ESPLOSA 2 byte alla volta...
|
||||
if (rawData.Length > 0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -75,7 +76,7 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
----------------------------------------------------- */
|
||||
DateTime adesso = DateTime.Now;
|
||||
// se ha risposto ad ultima chiamata --> ok
|
||||
if (connectionOk && adesso.Subtract(lastReadPLC).TotalMinutes < 1)
|
||||
if (connectionOk && adesso.Subtract(DtHelp.lastReadPLC).TotalMinutes < 1)
|
||||
{
|
||||
B_input = 3;
|
||||
// aggiungo NON emergenza...
|
||||
@@ -85,8 +86,8 @@ namespace IOB_WIN_MBUS.IobModbusTCP
|
||||
{
|
||||
B_input = 0;
|
||||
}
|
||||
lastReadPLC = DateTime.Now;
|
||||
lastWatchDog = adesso;
|
||||
DtHelp.lastReadPLC = DateTime.Now;
|
||||
DtHelp.lastWatchDog = adesso;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -24,8 +26,8 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
lgInfo("Start init Mitsubishi");
|
||||
// gestione invio ritardato contapezzi
|
||||
|
||||
lastPzCountSend = DateTime.Now;
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
|
||||
// inizializzo correttamente aree memoria secondo CONF - da IobConfFull
|
||||
IOB_UT_NEXT.Config.Mem.MemAreaDto currArea = new IOB_UT_NEXT.Config.Mem.MemAreaDto();
|
||||
@@ -883,14 +885,14 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("MITSUBISHI: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// ora PING!!!
|
||||
Ping pingSender = new Ping();
|
||||
IPAddress address = IPAddress.Loopback;
|
||||
@@ -934,7 +936,7 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
if (connectionOk)
|
||||
{
|
||||
checkVetoQueueIn();
|
||||
dtAvvioAdp = DateTime.Now;
|
||||
DtHelp.AvvioAdp = DateTime.Now;
|
||||
if (adpRunning)
|
||||
{
|
||||
lgInfo("Connessione OK");
|
||||
@@ -1641,10 +1643,10 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
if (DateTime.Now.Subtract(DtHelp.lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1661,7 +1663,7 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
{
|
||||
// controllo se è passato intervallo minimo tra 2
|
||||
// controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
// se sono differenti MOSTRO...
|
||||
if (contapezziPLC != contapezziIOB)
|
||||
@@ -1695,17 +1697,17 @@ namespace IOB_WIN_MITSUBISHI.Iob
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
if (DateTime.Now >= DtHelp.lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
lgInfo($"Attenzione: mancanza ODL non procedo con gestione contapezzi. contapezziPLC MITSUBISHI: {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+14
-29
@@ -1,8 +1,9 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using MTConnect.Assets;
|
||||
using MTConnect.Clients;
|
||||
using MTConnect.Devices;
|
||||
using MTConnect.Observations;
|
||||
@@ -10,15 +11,11 @@ using MTConnect.Streams;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace IOB_WIN_MTC.Iob
|
||||
{
|
||||
@@ -63,8 +60,8 @@ namespace IOB_WIN_MTC.Iob
|
||||
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
lastCurrent = adesso;
|
||||
// ora leggo il file di conf specifico....
|
||||
string jsonFileName = getOptPar("MTC_PARAM_CONF");
|
||||
@@ -178,7 +175,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastReadPLC = adesso;
|
||||
DtHelp.lastReadPLC = adesso;
|
||||
// verifico non sia in veto invio iniziale...
|
||||
if (queueInEnabCurr)
|
||||
{
|
||||
@@ -251,14 +248,14 @@ namespace IOB_WIN_MTC.Iob
|
||||
// disattivo eventuali sottoscrizioni
|
||||
DeactEvents();
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("MTC: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
@@ -273,7 +270,6 @@ namespace IOB_WIN_MTC.Iob
|
||||
if (connectionOk)
|
||||
{
|
||||
checkVetoQueueIn();
|
||||
//queueInEnabCurr = true;
|
||||
if (adpRunning)
|
||||
{
|
||||
lgInfo("Connessione OK");
|
||||
@@ -1352,8 +1348,8 @@ namespace IOB_WIN_MTC.Iob
|
||||
|
||||
// fix tempi!
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
lastCurrent = adesso;
|
||||
}
|
||||
catch
|
||||
@@ -2035,12 +2031,12 @@ namespace IOB_WIN_MTC.Iob
|
||||
{
|
||||
// verifico veto ad invio (ogni 60 min...)
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso > dtVetoSenDataItem)
|
||||
if (adesso > DtHelp.dtVetoSenDataItem)
|
||||
{
|
||||
string rawData = JsonConvert.SerializeObject(dataItems);
|
||||
var resp = HttpService.CallUrlPost($"{urlSaveDataItems}", rawData);
|
||||
// imposto nuovo veto
|
||||
dtVetoSenDataItem = adesso.AddMinutes(minVetoSendDataItem);
|
||||
DtHelp.dtVetoSenDataItem = adesso.AddMinutes(minVetoSendDataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2051,21 +2047,10 @@ namespace IOB_WIN_MTC.Iob
|
||||
/// <param name="observation"></param>
|
||||
private void traceObservation(IObservation observation)
|
||||
{
|
||||
#if DEBUG
|
||||
// SOLO in debug...
|
||||
#if false
|
||||
string sMsg = $"VETO: - {observation.DataItemId} | {observation.Category}";
|
||||
if (observation.Values != null && observation.Values.Count() > 0)
|
||||
{
|
||||
foreach (var item in observation.Values)
|
||||
{
|
||||
sMsg += $" | {item.Key}: {item.Value}";
|
||||
}
|
||||
}
|
||||
lgTrace(sMsg);
|
||||
trackExchDataRaw(sMsg.Length, 1024);
|
||||
#endif
|
||||
|
||||
trackExchData(64, 4096);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-WIN-NEXT", "IOB-WIN-NEXT.csproj", "{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.Build.0 = Debug|x86
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.ActiveCfg = Release|x86
|
||||
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5BF50E92-A90E-4117-812C-2BFC803594DB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,7 +1,4 @@
|
||||
#if false
|
||||
using EgwProxy.Ftp;
|
||||
#endif
|
||||
using EgwProxy.MultiCncLib.App.Native;
|
||||
using EgwProxy.MultiCncLib.App.Native;
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_WIN_FORM;
|
||||
@@ -23,7 +20,6 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using static IOB_UT_NEXT.BaseAlarmConf;
|
||||
using static IOB_UT_NEXT.CustomObj;
|
||||
using static IOB_UT_NEXT.DataModel.Fimat;
|
||||
using static MapoSDK.WharehouseData;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,8 +25,8 @@ namespace IOB_WIN_OMRON.Iob
|
||||
{
|
||||
// gestione invio ritardato contapezzi
|
||||
|
||||
lastPzCountSend = DateTime.Now;
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastPzCountSend = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
|
||||
// imposto i parametri PLC
|
||||
setParamPlc();
|
||||
@@ -61,24 +63,6 @@ namespace IOB_WIN_OMRON.Iob
|
||||
/// </summary>
|
||||
public override void processContapezzi()
|
||||
{
|
||||
if (utils.CRB("enableContapezzi"))
|
||||
{
|
||||
#if false
|
||||
try
|
||||
{
|
||||
// hard coded... !!!FARE!!! rivedere megio conf
|
||||
contapezziPLC = pzCounter;
|
||||
// verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
|
||||
if (cIobConf.optPar.Count > 0 && IOBConfFull.Device.PzCountMode != "")
|
||||
{
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in contapezzi OMRON");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -152,27 +136,6 @@ namespace IOB_WIN_OMRON.Iob
|
||||
public override bool setcontapezziPLC(int newPzCount, string codTav)
|
||||
{
|
||||
bool answ = false;
|
||||
#if false
|
||||
// ...SE abilitato da conf IOB
|
||||
if (cIobConf.optPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
|
||||
{
|
||||
// scrivo valore 0 x il contapezzi
|
||||
try
|
||||
{
|
||||
pzCounter = newPzCount;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in SET contapezzi OMRON");
|
||||
connectionOk = false;
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Impossibile effettuare SET contapezzi OMRON, mancanza parametro OPT:ENABLE_PZ_RESET");
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -184,14 +147,14 @@ namespace IOB_WIN_OMRON.Iob
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("OMRON: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
@@ -743,10 +706,10 @@ namespace IOB_WIN_OMRON.Iob
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
if (DateTime.Now.Subtract(DtHelp.lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
DtHelp.lastWarnODL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Config.Mem;
|
||||
using IOB_UT_NEXT.DataModel;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Objects;
|
||||
using IOB_UT_NEXT.Services.Files;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
@@ -16,7 +19,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static IOB_UT_NEXT.ByteDataConverter;
|
||||
using static IOB_UT_NEXT.Services.Core.ByteDataConverter;
|
||||
|
||||
namespace IOB_WIN_OPC_UA.IobOpc
|
||||
{
|
||||
@@ -49,8 +52,8 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
lastCurrent = adesso;
|
||||
lgTrace($"Aggiornato IobOpcUa.lastCurrent: {lastCurrent}");
|
||||
opcUaParams = IOBConfFull.Special.OpcUaConf;
|
||||
@@ -585,14 +588,14 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
if (DateTime.Now.Subtract(DtHelp.lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (verboseLog || periodicLog)
|
||||
{
|
||||
lgInfo("OpcUa: ConnKO - tryConnect");
|
||||
}
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
DtHelp.lastPING = DateTime.Now;
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success || opcUaParams.forcePingOk)
|
||||
{
|
||||
@@ -1633,9 +1636,9 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
lgTrace("WatchDog 01");
|
||||
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
|
||||
if (adesso.Subtract(DtHelp.lastWatchDogPLC).TotalSeconds > 2)
|
||||
{
|
||||
lastWatchDogPLC = adesso;
|
||||
DtHelp.lastWatchDogPLC = adesso;
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
@@ -2655,8 +2658,8 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
|
||||
// fix tempi!
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
DtHelp.lastPzCountSend = adesso;
|
||||
DtHelp.lastWarnODL = adesso;
|
||||
lastCurrent = adesso;
|
||||
lgTrace($"Aggiornato doConnect.lastCurrent: {lastCurrent}");
|
||||
}
|
||||
|
||||
@@ -143,9 +143,9 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
|
||||
if (adesso.Subtract(DtHelp.lastWatchDogPLC).TotalSeconds > 2)
|
||||
{
|
||||
lastWatchDogPLC = adesso;
|
||||
DtHelp.lastWatchDogPLC = adesso;
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
|
||||
@@ -147,9 +147,9 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
|
||||
if (adesso.Subtract(DtHelp.lastWatchDogPLC).TotalSeconds > 2)
|
||||
{
|
||||
lastWatchDogPLC = adesso;
|
||||
DtHelp.lastWatchDogPLC = adesso;
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
|
||||
@@ -137,9 +137,9 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
|
||||
if (adesso.Subtract(DtHelp.lastWatchDogPLC).TotalSeconds > 2)
|
||||
{
|
||||
lastWatchDogPLC = adesso;
|
||||
DtHelp.lastWatchDogPLC = adesso;
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using IOB_UT_NEXT;
|
||||
using IOB_UT_NEXT.Config;
|
||||
using IOB_UT_NEXT.Iob.Services;
|
||||
using IOB_UT_NEXT.Services.Networking;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using Opc.Ua;
|
||||
|
||||
@@ -147,9 +147,9 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
|
||||
if (adesso.Subtract(DtHelp.lastWatchDogPLC).TotalSeconds > 2)
|
||||
{
|
||||
lastWatchDogPLC = adesso;
|
||||
DtHelp.lastWatchDogPLC = adesso;
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user