Merge remote-tracking branch 'gitlab.steamware/feature/Giacovelli' into develop

This commit is contained in:
Samuele E. Locatelli
2022-05-26 18:50:32 +02:00
+62 -17
View File
@@ -29,21 +29,15 @@ namespace IOB_WIN_NEXT
* todo's
* --------------------------------------
* - init obj comunicazione da conf e nuget
* - test comunicazione
* - estensione IOB come OPT_PAR di OVERRIDE (x inviare dati di un unico iOB da più IOB programs)
* - gestione processCustomTaskLF
* - x lettura dei 2 batch correnti (sx/dx)
* - calcolo batch in corso/chiusi da date inizio/fine
* - trasmettere a MP/IO risultato valutazioni
* - gestione executeTasks
* - task di invio batch configurato in coda
* - task di recupero info anagrafiche (grower, variety, layout,...)
* - contapezzi (SE ha senso con sizer oppure saltare)
* - lanciare sync e verifica stato sync
*/
string connEntrataFrontiera = utils.CRS("EntrataFrontiera");
string connTrackerLotti = utils.CRS("TrackerLotti");
string connExportIcoel = utils.CRS("ExportIcoel");
string connSyncState = utils.CRS("SyncState");
dbProxy = new DbProxy(connEntrataFrontiera, connTrackerLotti, connExportIcoel, connSyncState);
#if false
IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort);
#endif
lastPING = DateTime.Now.AddHours(-1);
}
@@ -60,6 +54,7 @@ namespace IOB_WIN_NEXT
{
B_input = 1;
currDispData.semIn = Semaforo.SV;
#if false
if (currBatchList == null)
{
// se nullo --> provo a leggere!
@@ -68,10 +63,8 @@ namespace IOB_WIN_NEXT
if (currBatch != null)
{
currBatchList = currBatch;
#if false
// accodo invio!
string rawBatch = JsonConvert.SerializeObject(currBatch);
#endif
accodaRawData(IOB_UT_NEXT.rawTransfType.IcoelBatch, currBatch);
}
}
@@ -83,6 +76,7 @@ namespace IOB_WIN_NEXT
B_input = 3;
}
}
#endif
}
else
{
@@ -98,6 +92,9 @@ namespace IOB_WIN_NEXT
{
// valore non presente in vers default... se gestito fare override
Dictionary<string, string> outVal = new Dictionary<string, string>();
// mettere conteggio dei record trasferiti?!?
#if false
// recupero da libreria il dizionario dei performance parameters...
var perfParamDict = IcoelSizer.GetPerfMeters();
foreach (var item in perfParamDict)
@@ -105,6 +102,7 @@ namespace IOB_WIN_NEXT
saveValue(ref outVal, item.Value, item.Key);
}
#endif
lastReadPLC = DateTime.Now;
return outVal;
}
@@ -142,6 +140,51 @@ namespace IOB_WIN_NEXT
public override void processCustomTaskLF()
{
lgInfo($"Richiesto processCustomTaskLF");
// fare processing DB secondo il seguente scehma:
/*
*
EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState"));
Console.WriteLine();
Console.WriteLine("--- SyncState ---");
bool needRedo = true;
var elencoSyncState = dbProxy.DataController.SyncStateGetAll();
while (needRedo)
{
Console.WriteLine(" --- PRE --- ");
if (elencoSyncState != null)
{
foreach (var item in elencoSyncState)
{
Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}");
// verifico se serva redo..
}
}
Console.WriteLine();
Console.WriteLine("Premere un tasto x continuare...");
Console.ReadKey();
Stopwatch sw = new Stopwatch();
sw.Start();
elencoSyncState = dbProxy.DataController.SyncStateDoImportAll();
sw.Stop();
Console.WriteLine($" process time: {sw.ElapsedMilliseconds} ms ");
Console.WriteLine(" --- POST --- ");
if (elencoSyncState != null)
{
foreach (var item in elencoSyncState)
{
Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}");
// verifico se serva redo..
}
}
// processo
needRedo = testNeedRedo(elencoSyncState);
}
*
*
* */
#if false
var currBatch = IcoelSizer.GetCurrentBatch();
if (currBatch != null)
@@ -255,7 +298,7 @@ namespace IOB_WIN_NEXT
protected Dictionary<int, Batch> currBatchList { get; set; }
#endif
protected Connector IcoelSizer { get; set; }
protected EgwProxy.Icoel.DbProxy dbProxy { get; set; }
#endregion Protected Properties
@@ -266,6 +309,7 @@ namespace IOB_WIN_NEXT
/// </summary>
protected void refreshVarietyData()
{
#if false
///determina se recuperare SOLO varietà attive o tutte
bool soloAttive = false;
var varList = IcoelSizer.GetVarietyList(soloAttive);
@@ -274,7 +318,8 @@ namespace IOB_WIN_NEXT
var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
// invio dai al server IO
}
}
#endif
lastReadPLC = DateTime.Now;
}