diff --git a/MTC_Adapter/MTC_Adapter/AdapterConf.cs b/MTC_Adapter/MTC_Adapter/AdapterConf.cs index 807f466..7ed9d79 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterConf.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterConf.cs @@ -30,6 +30,8 @@ namespace MTC_Adapter element[] _VacuumPump; element[] _VacuumAct; element[] _Lubro; + element[] _SlittaMag; + element[] _ProtMag; element[] _Cooler; element[] _Press; element[] _Temp; @@ -97,6 +99,40 @@ namespace MTC_Adapter return answ; } } + public int nSlittaMag + { + get + { + int answ = 0; + if (SlittaMag != null) + { + try + { + answ = Convert.ToInt32(SlittaMag.Length); + } + catch + { } + } + return answ; + } + } + public int nProtMag + { + get + { + int answ = 0; + if (ProtMag != null) + { + try + { + answ = Convert.ToInt32(ProtMag.Length); + } + catch + { } + } + return answ; + } + } public int nCooler { get @@ -319,6 +355,16 @@ namespace MTC_Adapter get { return _Lubro; } set { _Lubro = value; } } + public element[] SlittaMag + { + get { return _SlittaMag; } + set { _SlittaMag = value; } + } + public element[] ProtMag + { + get { return _ProtMag; } + set { _ProtMag = value; } + } public element[] Cooler { get { return _Cooler; } diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs index c587c51..16674cf 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs @@ -88,6 +88,48 @@ namespace MTC_Adapter } } /// + /// Singola Slitta Mag, 0..n + /// + public class SlittaMag : element + { + /// + /// valore numero attivazioni/disattivazioni slitta magazzino + /// + public Event mSlittaMagCount; + /// + /// Classe Slitta Magazzino + /// + /// element base contenente parametri (da XML) + public SlittaMag(element baseElem) + { + ident = baseElem.ident; + dataRefList = baseElem.dataRefList; + + mSlittaMagCount = new Event(string.Format("{0}_Count", ident)); + } + } + /// + /// Singolo attuatore Protezione Magazzino, 0..n + /// + public class ProtMag : element + { + /// + /// valore numero attivazioni/disattivazioni valvola + /// + public Event mProtMagCount; + /// + /// Classe Protezione Magazzino + /// + /// element base contenente parametri (da XML) + public ProtMag(element baseElem) + { + ident = baseElem.ident; + dataRefList = baseElem.dataRefList; + + mProtMagCount = new Event(string.Format("{0}_Count", ident)); + } + } + /// /// Singolo refrigeratore, 0..n /// public class Cooler : element @@ -662,7 +704,18 @@ namespace MTC_Adapter /// Vettore ATTUALE dei contatori del numero cambi utensili x UnOp /// public uint[] currNumCambiUt; - + /// + /// Conteggio ATTUALE numero movimenti Slitta Tastatore + /// + public double contSlittaTast; + /// + /// Vettore ATTUALE dei contatori del numero movimenti Slitta Magazzino + /// + public uint[] currSlittaMag; + /// + /// Vettore ATTUALE dei contatori del numero movimenti Protezione Magazzino + /// + public uint[] currProtMag; /// /// Conteggio ISTANTANEO ore macchina ON @@ -716,7 +769,18 @@ namespace MTC_Adapter /// Vettore ISTANTANEO dei contatori del numero cambi utensili x UnOp /// public uint[] istNumCambiUt; - + /// + /// Conteggio ISTANTANEO contatore del numero movimenti Slitta Tastatore + /// + public double istSlittaTast; + /// + /// Vettore ISTANTANEO dei contatori del numero movimenti Slitta Magazzino + /// + public uint[] istSlittaMag; + /// + /// Vettore ISTANTANEO dei contatori del numero movimenti Protezione Magazzino + /// + public uint[] istProtMag; /// /// data-ora ultimo controllo movimento assi @@ -974,6 +1038,8 @@ namespace MTC_Adapter public VacuumPump[] vettVacPump; public VacuumAct[] vettVacAct; public Lubro[] vettLubro; + public SlittaMag[] vettSlittaMag; + public ProtMag[] vettProtMag; public Cooler[] vettCooler; public Press[] vettPress; public Tempe[] vettTempe; @@ -1077,6 +1143,20 @@ namespace MTC_Adapter mAdapter.AddDataItem(vettLubro[i].mLubroNum); mAdapter.AddDataItem(vettLubro[i].mLubroStatus); } + // Slitta Mag + vettSlittaMag = new SlittaMag[adpConf.nSlittaMag]; + for (int i = 0; i < adpConf.nLubro; i++) + { + vettSlittaMag[i] = new SlittaMag(adpConf.SlittaMag[i]); + mAdapter.AddDataItem(vettSlittaMag[i].mSlittaMagCount); + } + // Protezione Mag + vettProtMag = new ProtMag[adpConf.nProtMag]; + for (int i = 0; i < adpConf.nLubro; i++) + { + vettProtMag[i] = new ProtMag(adpConf.ProtMag[i]); + mAdapter.AddDataItem(vettProtMag[i].mProtMagCount); + } // Cooler vettCooler = new Cooler[adpConf.nCooler]; for (int i = 0; i < adpConf.nCooler; i++) @@ -1392,6 +1472,16 @@ namespace MTC_Adapter { currLubroCount[i] = getStoredValUInt(string.Format("Lubro_{0:00}_Count", i + 1)); } + + for (int i = 0; i < currAdpConf.nSlittaMag; i++) + { + currSlittaMag[i] = getStoredValUInt(string.Format("SlittaMagazzino_{0:00}_Count", i + 1)); + } + + for (int i = 0; i < currAdpConf.nProtMag; i++) + { + currProtMag[i] = getStoredValUInt(string.Format("ProtMagazzino_{0:00}_Count", i + 1)); + } } /// @@ -1519,6 +1609,28 @@ namespace MTC_Adapter // recupero valori... currLubroCount[i] = Convert.ToUInt32(riLubro.Value); } + currSlittaMag = new uint[currAdpConf.nSlittaMag]; + istSlittaMag = new uint[currAdpConf.nSlittaMag]; + for (int i = 0; i < currAdpConf.nSlittaMag; i++) + { + // leggo tutti i dati... + List> listaDR = currAdpConf.SlittaMag[i].dataRefList; + // punto all'item + DataRefItem riSlittaMag = listaDR.Find(x => x.Key == string.Format("SlittaMagazzino_{0:00}_Count", i + 1)); + // recupero valori... + currSlittaMag[i] = Convert.ToUInt32(riSlittaMag.Value); + } + currProtMag = new uint[currAdpConf.nProtMag]; + istProtMag = new uint[currAdpConf.nProtMag]; + for (int i = 0; i < currAdpConf.nProtMag; i++) + { + // leggo tutti i dati... + List> listaDR = currAdpConf.ProtMag[i].dataRefList; + // punto all'item + DataRefItem riProtMag= listaDR.Find(x => x.Key == string.Format("ProtMagazzino_{0:00}_Count", i + 1)); + // recupero valori... + currProtMag[i] = Convert.ToUInt32(riProtMag.Value); + } //mAlarmSystem.Normal(); mAlarmCNC.Normal(); @@ -2132,6 +2244,42 @@ namespace MTC_Adapter } } } + else if (maintData[i].varName== "SlittaTastatore_Count") + { + //istOreMaccLav = tabDatiMtz[i]; + } + else if (maintData[i].varName.StartsWith("SlittaMagazzino_")) + { + // if (maintData[i].varName.EndsWith("_Count")) + // { + // try + // { + // numero = Convert.ToInt32(maintData[i].varName.Replace("SlittaMagazzino_", "").Replace("_Count", "")); + // } + // catch + // { } + // if (numero > 0) + // { + // istLubroCount[numero - 1] = tabDatiMtz[i]; + // } + // } + } + else if (maintData[i].varName.StartsWith("ProtMagazzino_")) + { + // if (maintData[i].varName.EndsWith("_Count")) + // { + // try + // { + // numero = Convert.ToInt32(maintData[i].varName.Replace("ProtMagazzino_", "").Replace("_Count", "")); + // } + // catch + // { } + // if (numero > 0) + // { + // istLubroCount[numero - 1] = tabDatiMtz[i]; + // } + // } + } } } /// @@ -2156,6 +2304,8 @@ namespace MTC_Adapter needSave = procVacPump(needSave); needSave = procVacAct(needSave); needSave = procLubro(needSave); + needSave = procSlittaMag(needSave); + needSave = procProtMag(needSave); // salvo se necessario! if (needSave) parentForm.persistData(); @@ -2708,6 +2858,66 @@ namespace MTC_Adapter parentForm.dataMonitor += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine); return needSave; } + /// + /// Processing delle variabili sui componenti SlittaMag + /// + /// + /// + public bool procSlittaMag(bool needSave) + { + uint delta = 0; + string outString = string.Format("SlittaMagazzino_[1-{0}]_Count: ", currAdpConf.nSlittaMag); + for (int i = 0; i < currAdpConf.nSlittaMag; i++) + { + delta = istSlittaMag[i] - currSlittaMag[i]; + //processo comunque sempre... + uint contTot = updateValUIntByIncr(i, delta, "SlittaMagazzino_{0:00}_Count"); + // passo valore totale all'adapter + vettSlittaMag[i].mSlittaMagCount.Value = contTot; + // controllo valore riferimento... + if (delta > 0) + { + // segnalo necessità salvataggio! + needSave = true; + } + // ...aggiorno valore riferimento... + currSlittaMag[i] = istSlittaMag[i]; + outString += string.Format("{0} | ", vettSlittaMag[i].mSlittaMagCount.Value); + } + // salvo su maschera... + parentForm.dataMonitor += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine); + return needSave; + } + /// + /// Processing delle variabili sui componenti ProtMag + /// + /// + /// + public bool procProtMag(bool needSave) + { + uint delta = 0; + string outString = string.Format("ProtMagazzino_[1-{0}]_Count: ", currAdpConf.nProtMag); + for (int i = 0; i < currAdpConf.nProtMag; i++) + { + delta = istProtMag[i] - currProtMag[i]; + //processo comunque sempre... + uint contTot = updateValUIntByIncr(i, delta, "ProtMagazzino_{0:00}_Count"); + // passo valore totale all'adapter + vettProtMag[i].mProtMagCount.Value = contTot; + // controllo valore riferimento... + if (delta > 0) + { + // segnalo necessità salvataggio! + needSave = true; + } + // ...aggiorno valore riferimento... + currProtMag[i] = istProtMag[i]; + outString += string.Format("{0} | ", vettProtMag[i].mProtMagCount.Value); + } + // salvo su maschera... + parentForm.dataMonitor += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine); + return needSave; + } #endregion diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index 76d23d5..56d03bd 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -1120,7 +1120,6 @@ namespace MTC_Adapter checkSavePersDataLayer(); } - /// /// Gestione lettura dati status da PLC /// diff --git a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj index ce534f4..3efdf68 100644 --- a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj +++ b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj @@ -163,13 +163,13 @@ SetupAdapter.cs - - + + Designer - - + + Designer - + @@ -214,6 +214,9 @@ + + + @@ -227,9 +230,9 @@ Designer - + Designer - + @@ -242,7 +245,7 @@ - + Always @@ -311,14 +314,14 @@ - + Designer - + Always - + Always