From 9f02e6117256243cb43968db766ee314222de29e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 20 Apr 2017 22:49:39 +0200 Subject: [PATCH] =?UTF-8?q?parte=20senza=20errori=20x=20gestioen=20contato?= =?UTF-8?q?ri=20(anche=20SE=20mi=20sembrano=20cannate=20le=20unit=C3=A0=20?= =?UTF-8?q?di=20misura...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MTC_Adapter/MTC_Adapter/AdapterOsai.cs | 35 ++++++++------- MTC_Adapter/MTC_Adapter/MainForm.cs | 61 ++++++++++++++------------ 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index b84a00d..e5b6d90 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -1289,23 +1289,26 @@ namespace MTC_Adapter } } - // verifica se si debba aggiornare XML (e salva in adapter dati vari) - needSave = procOreMaccOn(needSave); - needSave = procOreMaccLav(needSave); - needSave = procProgrName(needSave); - needSave = procPartId(needSave); - needSave = procPzProd(needSave); - needSave = procGiriTotUnOp(needSave); - needSave = procNumCU(needSave); - needSave = procMovTotAssi(needSave); - needSave = procAccTimeAssi(needSave); - needSave = procNumInvAssi(needSave); - needSave = procVacPump(needSave); - needSave = procVacAct(needSave); - needSave = procLubro(needSave); + if (persistenceLayer != null) + { + // verifica se si debba aggiornare XML (e salva in adapter dati vari) + needSave = procOreMaccOn(needSave); + needSave = procOreMaccLav(needSave); + needSave = procProgrName(needSave); + needSave = procPartId(needSave); + needSave = procPzProd(needSave); + needSave = procGiriTotUnOp(needSave); + needSave = procNumCU(needSave); + needSave = procMovTotAssi(needSave); + needSave = procAccTimeAssi(needSave); + needSave = procNumInvAssi(needSave); + needSave = procVacPump(needSave); + needSave = procVacAct(needSave); + needSave = procLubro(needSave); - // salvo se necessario! - if (needSave) parentForm.persistData(); + // salvo se necessario! + if (needSave) parentForm.persistData(); + } // ------------------------------------------- } diff --git a/MTC_Adapter/MTC_Adapter/MainForm.cs b/MTC_Adapter/MTC_Adapter/MainForm.cs index 13e92cd..0933427 100644 --- a/MTC_Adapter/MTC_Adapter/MainForm.cs +++ b/MTC_Adapter/MTC_Adapter/MainForm.cs @@ -159,12 +159,12 @@ namespace MTC_Adapter // se abilitato autoload conf leggo file corretto... if (utils.CRB("autoLoadConf")) { + loadXmlFile(defConfFilePath); + lg.Info("XML LOADED"); loadPersistLayer(defPersLayerFile); lg.Info("PersLayerFile READ"); agObj.loadPersData(); lg.Info("PersLayerFile LOADED"); - loadXmlFile(defConfFilePath); - lg.Info("XML LOADED"); } else { @@ -491,31 +491,38 @@ namespace MTC_Adapter public void avviaAdapter() { displayTaskAndWait("Adapter starting"); - - int porta = Convert.ToInt32(port.Text); - agObj.startAdapter(porta); - displayTaskAndWait("Adapter started!"); - - // fix buttons start/stop/dump - start.Enabled = false; - stop.Enabled = true; - dump.Enabled = true; - if (utils.CRB("openDumpOnStart")) + // se NON sta girando... + if (!agObj.adpRunning) { - displayTaskAndWait("Dump Window starting"); - apriDumpAgent(); - displayTaskAndWait("Dump Windows OK"); - } + int porta = Convert.ToInt32(port.Text); + agObj.startAdapter(porta); + displayTaskAndWait("Adapter started!"); - displayTaskAndWait("Start Timers"); - // inizializzo contatori fast/mid/slow - fastCount = utils.CRI("fastCount"); - normCount = utils.CRI("normCount"); - slowCount = utils.CRI("slowCount"); - alarmSyncCount = utils.CRI("alarmSyncCount"); - displayTaskAndWait("Adapter Running..."); - // forzo check allarmi.. - agObj.forceAlarmCheck(); + // fix buttons start/stop/dump + start.Enabled = false; + stop.Enabled = true; + dump.Enabled = true; + if (utils.CRB("openDumpOnStart")) + { + displayTaskAndWait("Dump Window starting"); + apriDumpAgent(); + displayTaskAndWait("Dump Windows OK"); + } + + displayTaskAndWait("Start Timers"); + // inizializzo contatori fast/mid/slow + fastCount = utils.CRI("fastCount"); + normCount = utils.CRI("normCount"); + slowCount = utils.CRI("slowCount"); + alarmSyncCount = utils.CRI("alarmSyncCount"); + displayTaskAndWait("Adapter Running..."); + // forzo check allarmi.. + agObj.forceAlarmCheck(); + } + else + { + displayTaskAndWait("Adapter STILL Running..."); + } } /// @@ -1131,12 +1138,12 @@ namespace MTC_Adapter if (userClickedOK == DialogResult.OK) { string XmlConfFile = openFileDial.FileName; + loadXmlFile(XmlConfFile); + lg.Info("XML LOADED"); loadPersistLayer(defPersLayerFile); lg.Info("PersLayerFile READ"); agObj.loadPersData(); lg.Info("PersLayerFile LOADED"); - loadXmlFile(XmlConfFile); - lg.Info("XML LOADED"); } } ///