diff --git a/IOB-WIN/IobMTC.cs b/IOB-WIN/IobMTC.cs
index e056c371..c5b60e86 100644
--- a/IOB-WIN/IobMTC.cs
+++ b/IOB-WIN/IobMTC.cs
@@ -5,6 +5,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
+using System.Threading;
using MTConnectDevices = MTConnect.MTConnectDevices;
using MTConnectStreams = MTConnect.MTConnectStreams;
@@ -30,6 +31,10 @@ namespace IOB_WIN
///
protected bool enableDataFilter = false;
///
+ /// Determina se ha effettuata lettura items in memoria x confronto...
+ ///
+ protected bool hasReadItems = false;
+ ///
/// URL x salvataggio elenco dataItems MTC
///
protected string urlSaveDataItems
@@ -185,14 +190,18 @@ namespace IOB_WIN
lgInfo($"---------------- Elenco Devices ----------------");
// loggo devices principali...
logDevicesList(probe.Devices);
+#if false
// chiamo il device succesful!
- DevicesSuccessful(probe);
+ DevicesSuccessful(probe);
+#endif
}
}
catch (Exception exc)
{
lgError($"Eccezione durante test probe:{Environment.NewLine}{exc}");
}
+ // attendo 1 sec...
+ Thread.Sleep(1000);
// ora avvio
try
{
@@ -203,6 +212,8 @@ namespace IOB_WIN
MTC_ref.CurrentReceived += StreamsSuccessful;
MTC_ref.SampleReceived += StreamsSuccessful;
+ // attendo 1 sec...
+ Thread.Sleep(1000);
MTC_ref.Start();
esitoLink = 1;
}
@@ -224,11 +235,12 @@ namespace IOB_WIN
foreach (var device in document.Devices)
{
List dataItems = device.GetDataItems();
+ lgInfo("Inizio STEP 02");
//if (verboseLog)
//{
foreach (var dataItem in dataItems)
{
- string sVal = $"STEP 02 | Category: {dataItem.Category} | Type: {dataItem.Type} | Id: {dataItem.Id} | Name: {dataItem.Name}";
+ string sVal = $"STEP 03 | Category: {dataItem.Category} | Type: {dataItem.Type} | Id: {dataItem.Id} | Name: {dataItem.Name}";
lgInfo(sVal);
try
{
@@ -248,17 +260,26 @@ namespace IOB_WIN
SubType = dataItem.SubType,
Units = dataItem.Units
};
- // aggiungo
- elencoDataItems.Add(currMapoDataItem);
+ // aggiungo se non ci fosse
+ if (!elencoDataItems.Contains(currMapoDataItem))
+ {
+ elencoDataItems.Add(currMapoDataItem);
+ }
}
catch (Exception exc)
{
lgError($"Eccezione in DevicesSuccessful / DataItem:{Environment.NewLine}{exc}");
}
}
- // invio IN BLOCCO il dataItem serializzati...
+ }
+ // invio IN BLOCCO il dataItem serializzati...
+ if (elencoDataItems.Count > 0)
+ {
+ lgInfo("STEP 04 invio dati");
sendDataItemsList(elencoDataItems);
}
+ hasReadItems = true;
+ lgInfo($"STEP 05: memorizzati {dataItemMem.Count} oggetti in memoria");
//}
}
else
@@ -437,28 +458,35 @@ namespace IOB_WIN
{
// registro non trovato da aggiungere...
lgInfo($"DataItem non trovato in checkSaveItem: {newValue.DataItemId}");
- // provo a creare oggetot in memoria...
- List elencoDataItems = new List();
- int dSamplePeriod = 0;
- int threshDBand = 0;
- string uuid = "";
- var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newValue);
- // aggiungo
- dataItemMem.Add(newValue.DataItemId, currDataItem);
- // salvo oggetto x registrazione su server MP-IO
- var currMapoDataItem = new machDataItem()
+ try
{
- uuid = newValue.DataItemId,
- Category = (DataItemCategory)newValue.Category,
- Name = newValue.Name,
- Type = newValue.Type,
- SubType = newValue.SubType,
- //Units = newValue.Units
- };
- // aggiungo
- elencoDataItems.Add(currMapoDataItem);
- // invio il dataItem serializzato...
- sendDataItemsList(elencoDataItems);
+ // provo a creare oggetot in memoria...
+ List elencoDataItems = new List();
+ int dSamplePeriod = 0;
+ int threshDBand = 0;
+ string uuid = "";
+ var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newValue);
+ // aggiungo
+ dataItemMem.Add(newValue.DataItemId, currDataItem);
+ // salvo oggetto x registrazione su server MP-IO
+ var currMapoDataItem = new machDataItem()
+ {
+ uuid = newValue.DataItemId,
+ Category = (DataItemCategory)newValue.Category,
+ Name = newValue.Name,
+ Type = newValue.Type,
+ SubType = newValue.SubType,
+ //Units = newValue.Units
+ };
+ // aggiungo
+ elencoDataItems.Add(currMapoDataItem);
+ // invio il dataItem serializzato...
+ sendDataItemsList(elencoDataItems);
+ }
+ catch (Exception exc)
+ {
+ lgError($"Eccezione in checkSaveSample{Environment.NewLine}{exc}");
+ }
}
}
else
@@ -529,27 +557,34 @@ namespace IOB_WIN
// registro non trovato da aggiungere...
lgInfo($"DataItem non trovato in checkSaveSample: {newValue.DataItemId}");
// provo a creare oggetot in memoria...
- List elencoDataItems = new List();
- int dSamplePeriod = 0;
- int threshDBand = 0;
- string uuid = "";
- var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newValue);
- // aggiungo
- dataItemMem.Add(newValue.DataItemId, currDataItem);
- // salvo oggetto x registrazione su server MP-IO
- var currMapoDataItem = new machDataItem()
+ try
{
- uuid = newValue.DataItemId,
- Category = (DataItemCategory)newValue.Category,
- Name = newValue.Name,
- Type = newValue.Type,
- SubType = newValue.SubType,
- //Units = newValue.Units
- };
- // aggiungo
- elencoDataItems.Add(currMapoDataItem);
- // invio il dataItem serializzato...
- sendDataItemsList(elencoDataItems);
+ List elencoDataItems = new List();
+ int dSamplePeriod = 0;
+ int threshDBand = 0;
+ string uuid = "";
+ var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newValue);
+ // aggiungo
+ dataItemMem.Add(newValue.DataItemId, currDataItem);
+ // salvo oggetto x registrazione su server MP-IO
+ var currMapoDataItem = new machDataItem()
+ {
+ uuid = newValue.DataItemId,
+ Category = (DataItemCategory)newValue.Category,
+ Name = newValue.Name,
+ Type = newValue.Type,
+ SubType = newValue.SubType,
+ //Units = newValue.Units
+ };
+ // aggiungo
+ elencoDataItems.Add(currMapoDataItem);
+ // invio il dataItem serializzato...
+ sendDataItemsList(elencoDataItems);
+ }
+ catch (Exception exc)
+ {
+ lgError($"Eccezione in checkSaveSample{Environment.NewLine}{exc}");
+ }
}
}
else
diff --git a/Jenkinsfile b/Jenkinsfile
index a8264833..672b01f3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -16,7 +16,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=560']) {
+ withEnv(['NEXT_BUILD_NUMBER=562']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'