Altro metodo x recuperare oggetti non inizializzati + logging iniziale...
This commit is contained in:
+111
-35
@@ -212,7 +212,7 @@ namespace IOB_WIN
|
||||
}
|
||||
protected void DevicesSuccessful(MTConnectDevices.Document document)
|
||||
{
|
||||
lgInfo("STEP DevicesSuccessful reached!");
|
||||
lgInfo("STEP 01 DevicesSuccessful reached!");
|
||||
MtcDataItemExt currDataItem = null;
|
||||
machDataItem currMapoDataItem = null;
|
||||
List<machDataItem> elencoDataItems = new List<machDataItem>();
|
||||
@@ -224,45 +224,100 @@ namespace IOB_WIN
|
||||
foreach (var device in document.Devices)
|
||||
{
|
||||
List<MTConnectDevices.DataItem> dataItems = device.GetDataItems();
|
||||
if (verboseLog)
|
||||
//if (verboseLog)
|
||||
//{
|
||||
foreach (var dataItem in dataItems)
|
||||
{
|
||||
foreach (var dataItem in dataItems)
|
||||
string sVal = $"STEP 02 | Category: {dataItem.Category} | Type: {dataItem.Type} | Id: {dataItem.Id} | Name: {dataItem.Name}";
|
||||
lgInfo(sVal);
|
||||
try
|
||||
{
|
||||
string sVal = $"Category: {dataItem.Category} | Type: {dataItem.Type} | Id: {dataItem.Id} | Name: {dataItem.Name}";
|
||||
lgInfo(sVal);
|
||||
try
|
||||
currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, dataItem);
|
||||
// aggiungo se non c'è...
|
||||
if (!dataItemMem.ContainsKey(dataItem.Id))
|
||||
{
|
||||
currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, dataItem);
|
||||
// aggiungo se non c'è...
|
||||
if (!dataItemMem.ContainsKey(dataItem.Id))
|
||||
{
|
||||
dataItemMem.Add(dataItem.Id, currDataItem);
|
||||
}
|
||||
// salvo oggetto x registrazione su server MP-IO
|
||||
currMapoDataItem = new machDataItem()
|
||||
{
|
||||
uuid = dataItem.Id,
|
||||
Category = (DataItemCategory)dataItem.Category,
|
||||
Name = dataItem.Name,
|
||||
Type = dataItem.Type,
|
||||
SubType = dataItem.SubType,
|
||||
Units = dataItem.Units
|
||||
};
|
||||
// aggiungo
|
||||
elencoDataItems.Add(currMapoDataItem);
|
||||
dataItemMem.Add(dataItem.Id, currDataItem);
|
||||
}
|
||||
catch (Exception exc)
|
||||
// salvo oggetto x registrazione su server MP-IO
|
||||
currMapoDataItem = new machDataItem()
|
||||
{
|
||||
lgError($"Eccezione in DevicesSuccessful / DataItem:{Environment.NewLine}{exc}");
|
||||
}
|
||||
uuid = dataItem.Id,
|
||||
Category = (DataItemCategory)dataItem.Category,
|
||||
Name = dataItem.Name,
|
||||
Type = dataItem.Type,
|
||||
SubType = dataItem.SubType,
|
||||
Units = dataItem.Units
|
||||
};
|
||||
// aggiungo
|
||||
elencoDataItems.Add(currMapoDataItem);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Eccezione in DevicesSuccessful / DataItem:{Environment.NewLine}{exc}");
|
||||
}
|
||||
// invio IN BLOCCO il dataItem serializzati...
|
||||
sendDataItemsList(elencoDataItems);
|
||||
}
|
||||
// invio IN BLOCCO il dataItem serializzati...
|
||||
sendDataItemsList(elencoDataItems);
|
||||
}
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("STEP 02 error: document null!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formatta un dataitem da uno stream SAMPLE
|
||||
/// </summary>
|
||||
/// <param name="dSamplePeriod"></param>
|
||||
/// <param name="threshDBand"></param>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="DISample"></param>
|
||||
/// <returns></returns>
|
||||
private MtcDataItemExt formatDataItem(ref int dSamplePeriod, ref int threshDBand, ref string uuid, MTConnectStreams.Sample DISample)
|
||||
{
|
||||
// creo il nuovo dataitem da sample...
|
||||
MTConnectDevices.DataItem newDataItem = new MTConnectDevices.DataItem()
|
||||
{
|
||||
Category = DISample.Category,
|
||||
Id = DISample.DataItemId,
|
||||
Name = DISample.Name,
|
||||
SampleRate = DISample.SampleRate,
|
||||
Statistic = DISample.Statistic,
|
||||
SubType = DISample.SubType,
|
||||
Type = DISample.Type
|
||||
};
|
||||
return formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newDataItem);
|
||||
}
|
||||
/// <summary>
|
||||
/// Formatta un dataitem da uno stream GENERICO
|
||||
/// </summary>
|
||||
/// <param name="dSamplePeriod"></param>
|
||||
/// <param name="threshDBand"></param>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="DIGen"></param>
|
||||
/// <returns></returns>
|
||||
private MtcDataItemExt formatDataItem(ref int dSamplePeriod, ref int threshDBand, ref string uuid, MTConnectStreams.DataItem DIGen)
|
||||
{
|
||||
// creo il nuovo dataitem da sample...
|
||||
MTConnectDevices.DataItem newDataItem = new MTConnectDevices.DataItem()
|
||||
{
|
||||
Category = DIGen.Category,
|
||||
Id = DIGen.DataItemId,
|
||||
Name = DIGen.Name,
|
||||
SubType = DIGen.SubType,
|
||||
Type = DIGen.Type
|
||||
};
|
||||
return formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newDataItem);
|
||||
}
|
||||
/// <summary>
|
||||
/// Formatta un dataitem x salvataggio in memoria locale
|
||||
/// </summary>
|
||||
/// <param name="dSamplePeriod"></param>
|
||||
/// <param name="threshDBand"></param>
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="dataItem"></param>
|
||||
/// <returns></returns>
|
||||
private MtcDataItemExt formatDataItem(ref int dSamplePeriod, ref int threshDBand, ref string uuid, MTConnectDevices.DataItem dataItem)
|
||||
{
|
||||
MtcDataItemExt currDataItem;
|
||||
@@ -382,12 +437,12 @@ namespace IOB_WIN
|
||||
{
|
||||
// registro non trovato da aggiungere...
|
||||
lgInfo($"DataItem non trovato in checkSaveItem: {newValue.DataItemId}");
|
||||
#if false
|
||||
// provo a creare oggetot in memoria...
|
||||
List<machDataItem> elencoDataItems = new List<machDataItem>();
|
||||
int dSamplePeriod = 0;
|
||||
int threshDBand = 0;
|
||||
string uuid = "";
|
||||
var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, (MTConnectDevices.DataItem)newValue);
|
||||
var currDataItem = formatDataItem(ref dSamplePeriod, ref threshDBand, ref uuid, newValue);
|
||||
// aggiungo
|
||||
dataItemMem.Add(newValue.DataItemId, currDataItem);
|
||||
// salvo oggetto x registrazione su server MP-IO
|
||||
@@ -402,9 +457,8 @@ namespace IOB_WIN
|
||||
};
|
||||
// aggiungo
|
||||
elencoDataItems.Add(currMapoDataItem);
|
||||
// invio IN BLOCCO il dataItem serializzati...
|
||||
sendDataItemsList(elencoDataItems);
|
||||
#endif
|
||||
// invio il dataItem serializzato...
|
||||
sendDataItemsList(elencoDataItems);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -474,6 +528,28 @@ namespace IOB_WIN
|
||||
{
|
||||
// registro non trovato da aggiungere...
|
||||
lgInfo($"DataItem non trovato in checkSaveSample: {newValue.DataItemId}");
|
||||
// provo a creare oggetot in memoria...
|
||||
List<machDataItem> elencoDataItems = new List<machDataItem>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=559']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=560']) {
|
||||
// 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'
|
||||
|
||||
Reference in New Issue
Block a user