diff --git a/MTC_Adapter/MTC_Adapter/AdapterESA.cs b/MTC_Adapter/MTC_Adapter/AdapterESA.cs index e700a48..0ba418c 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterESA.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterESA.cs @@ -819,154 +819,9 @@ namespace MTC_Adapter } public override void getGlobalData() { - base.getGlobalData(); - + base.getGlobalData(); } - /// - /// Path percorso file prod - /// - protected string ScmProdFileName - { - get - { - return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("ScmProdFile")); - } - } - /// - /// Oggetto elenco dati produzione - /// - public datiProdSCM[] elencoDatiProd; - /// - /// leggo altri file: - /// - dati produzione - /// - public override void getSlowChangingData() - { - base.getSlowChangingData(); - - // carico dati x Maintenance - if (utils.CRB("verbose")) lg.Info(string.Format("Inizio caricamento file dati produzione ({0})", ScmProdFileName)); - int totRighe = 0; - string linea; - // controllo se file esista, altrimenti loggo errore! - if (!File.Exists(ScmProdFileName)) - { - lg.Error(string.Format("ATTENZIONE! file dati produzione ({0}) non trovato!", ScmProdFileName)); - } - else - { - totRighe = File.ReadLines(ScmProdFileName).Count(); - // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... - datiProdSCM[] elencoDatiProdNew = new datiProdSCM[File.ReadLines(ScmProdFileName).Count()]; - // carica da file... - System.IO.StreamReader file = new System.IO.StreamReader(ScmProdFileName); - // leggo 1 linea alla volta... - int rumRiga = 0; - while ((linea = file.ReadLine()) != null) - { - // SE non è un valore totale... lungh > 50 e 22 virgole (23 valori) - if (linea.Length > 50) - { - // comma separated! - elencoDatiProdNew[rumRiga] = decodeScmProdLine(linea, ','); - // se !=null conto! - if (elencoDatiProdNew != null) rumRiga++; - } - } - // chiudo file - file.Close(); - // ora trimmo vettore al solo numero VERO degli allarmi caricati... - Array.Resize(ref elencoDatiProdNew, rumRiga); - - /*-------------------------------------------------- - * Gestione verifica dati prod (naive) - * - se file curr vuoto --> inizio a popolare - * - se i 2 file hanno stessa lunghezza --> verifico + update last row - * - se nNew > nCurr --> accodo - * - se nCurr > nNew e nNew ==0 --> aggiorno last row giorno prec - * - se nCurr > nNew e nNew > 0 --> svuoto file curr e riparto - *--------------------------------------------------*/ - - - // verifica preliminare dati da lung vettori - int nRecCur = 0; - int nRecIst = 0; - if (elencoDatiProd != null) - { - try - { - nRecCur = elencoDatiProd.Length; - } - catch - { } - } - if (elencoDatiProdNew != null) - { - try - { - nRecIst = elencoDatiProdNew.Length; - } - catch - { } - } - - // uso un INT x delta qta da sommare... - int deltaQta = 0; - // in primis devo verificare che sia > 0 num oggetti su entrambi i vettori - if (nRecCur + nRecIst > 0) - { - // verifico se ho meno valori CURR e quindi devo accodare - if (nRecCur < nRecIst) - { - // resize vettore! - Array.Resize(ref elencoDatiProd, nRecCur + 1); - // carico nuovo record - elencoDatiProd[nRecCur] = elencoDatiProdNew[nRecCur]; - deltaQta = elencoDatiProd[nRecCur].qta; - nRecCur++; - } - else if (nRecCur == nRecIst) - { - // devo confrontare ULTIMO record Curr con equivalente record NEW x verificare se sia variato.. verifico PRG + start - bool checkName = elencoDatiProd[nRecCur - 1].fileName == elencoDatiProdNew[nRecCur - 1].fileName; - bool checkStart = elencoDatiProd[nRecCur - 1].start == elencoDatiProdNew[nRecCur - 1].start; - if (checkName && checkStart) - { - // salvo se variata quantità... - deltaQta = elencoDatiProdNew[nRecCur - 1].qta - elencoDatiProd[nRecCur - 1].qta; - elencoDatiProd[nRecCur - 1] = elencoDatiProdNew[nRecCur - 1]; - } - } - else - { - // inizio svuotando elenco eventi CURR (migliorabile leggendo da data prec?!?) - elencoDatiProd = null; - nRecCur = 0; - } - - // riporto comunque ultima riga del vettore CURR (sia perché variato sia perché aggiunto) - if (nRecCur > 0) - { - string prgName = elencoDatiProd[nRecCur - 1].fileName; - prgName = prgName.Substring(prgName.LastIndexOf(@"\") + 1); - // se il mio articolo NON cambia... - if (istPathPartId[0] == prgName) - { - istPathPartCount[0] += (uint)deltaQta; - } - else - { - istPathPartId[0] = prgName; - // 2016.07.27 riporto puntualmente qta nuovo record... - istPathPartCount[0] = (uint)deltaQta; - // old sostituito - //istPathPartCount[0] = Convert.ToUInt32(elencoDatiProd[nRecCur - 1].qta); - } - } - } - } - } /// /// Processing di TUTTA l'area di memoria configurata e delle variabili derivate... /// diff --git a/MTC_Adapter/MTC_Adapter/App.config b/MTC_Adapter/MTC_Adapter/App.config index f9af073..b500008 100644 --- a/MTC_Adapter/MTC_Adapter/App.config +++ b/MTC_Adapter/MTC_Adapter/App.config @@ -69,7 +69,6 @@ -