diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index af255a51..3dff5571 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -1,13 +1,13 @@ -using MapoSDK; -using Newtonsoft.Json; -using SteamWare; -using System; +using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Globalization; using System.Reflection; using System.Threading; +using MapoSDK; +using Newtonsoft.Json; +using SteamWare; namespace MapoDb { @@ -41,9 +41,6 @@ namespace MapoDb public DS_ProdTempiTableAdapters.stp_repDonati_getDatiProdMacchinaPeriodoTableAdapter taDatiProdMacchPer; public DS_ProdTempiTableAdapters.stp_repDonati_getLastStatoDurataMacchinaTableAdapter taDatiStatoMacch; public DS_ProdTempiTableAdapters.PostazioniMapoTableAdapter taPostazioni; -#if false - public DS_ProdTempiTableAdapters.DatiConfermatiTableAdapter taDatiConfermati; -#endif public DS_ProdTempiTableAdapters.stp_PzProd_getByMacchinaTableAdapter taPzProd2conf; public DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTempiCicloRilevati; public DS_ProdTempiTableAdapters.DatiProduzioneTableAdapter taDatiProd; @@ -75,7 +72,6 @@ namespace MapoDb public DS_IntServTableAdapters.TransitoDatiTableAdapter taIS_TrDati; public DS_IntServTableAdapters.WipSetupKitTableAdapter taWKS; - /// /// init dei table adapters /// @@ -104,9 +100,6 @@ namespace MapoDb taDatiStatoMacch = new DS_ProdTempiTableAdapters.stp_repDonati_getLastStatoDurataMacchinaTableAdapter(); taPostazioni = new DS_ProdTempiTableAdapters.PostazioniMapoTableAdapter(); taTurniMacc = new DS_ProdTempiTableAdapters.TurniMacchinaTableAdapter(); -#if false - taDatiConfermati = new DS_ProdTempiTableAdapters.DatiConfermatiTableAdapter(); -#endif taPzProd2conf = new DS_ProdTempiTableAdapters.stp_PzProd_getByMacchinaTableAdapter(); taTempiCicloRilevati = new DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter(); taDatiProd = new DS_ProdTempiTableAdapters.DatiProduzioneTableAdapter(); @@ -166,9 +159,6 @@ namespace MapoDb taDatiStatoMacch.Connection.ConnectionString = connectionString; taPostazioni.Connection.ConnectionString = connectionString; taTurniMacc.Connection.ConnectionString = connectionString; -#if false - taDatiConfermati.Connection.ConnectionString = connectionString; -#endif taPzProd2conf.Connection.ConnectionString = connectionString; taTempiCicloRilevati.Connection.ConnectionString = connectionString; taDatiProd.Connection.ConnectionString = connectionString; @@ -231,9 +221,9 @@ namespace MapoDb void SetAllCommandTimeouts(object adapter, int timeout) { var commands = adapter.GetType().InvokeMember( - "CommandCollection", - BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic, - null, adapter, new object[0]); + "CommandCollection", + BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic, + null, adapter, new object[0]); var sqlCommand = (SqlCommand[])commands; foreach (var cmd in sqlCommand) { @@ -362,8 +352,7 @@ namespace MapoDb gestEmail.ge.mandaEmail(mittente, destinatario, oggetto, corpo); fatto = true; } - catch - { } + catch { } return fatto; } /// @@ -395,8 +384,7 @@ namespace MapoDb } fatto = true; } - catch - { } + catch { } return fatto; } @@ -418,18 +406,18 @@ namespace MapoDb // salvo matrOpr MatrOpr = matricola; /************************************************ - * Gestione riconoscimento devices - * - * - cerco IP del device, testo se è rete interna (A) o extranet/internet (B) cercando substring "localNet" da web.config - * (A): device interni: c'è un DHCP, e "dhcpLeaseTime" deve essere pari a lease time--- - * - verifico se IP già in uso da un tempo < "dhcpLeaseTime" --> in questo caso segnalo errore e rimbalzo (NON permetto di registrare device a nuovo utente... sospetto uso "improprio" del device - * - se tempo > dhcpLeaseTime allora può aver cambiato IP: aggiorno IP e descrizione del device e proseguo - * (B): all'esterno vedo tutta una subnet NATtata con unico IP, non è + discriminante - * - le timbrature "da esterno" devono essere confermate (instrodurre "tipo timbratura" x cui interne sono autoconfermate, esterne sono "grayed" (da confermare, da admin o ad esempio se si accende secondo device utente entro 5/10 min) - * - le timbrature ext DOVREBBERO chiedere location (jScript?) e inviarla, visibile in conferma - * - * - * **********************************************/ + * Gestione riconoscimento devices + * + * - cerco IP del device, testo se è rete interna (A) o extranet/internet (B) cercando substring "localNet" da web.config + * (A): device interni: c'è un DHCP, e "dhcpLeaseTime" deve essere pari a lease time--- + * - verifico se IP già in uso da un tempo < "dhcpLeaseTime" --> in questo caso segnalo errore e rimbalzo (NON permetto di registrare device a nuovo utente... sospetto uso "improprio" del device + * - se tempo > dhcpLeaseTime allora può aver cambiato IP: aggiorno IP e descrizione del device e proseguo + * (B): all'esterno vedo tutta una subnet NATtata con unico IP, non è + discriminante + * - le timbrature "da esterno" devono essere confermate (instrodurre "tipo timbratura" x cui interne sono autoconfermate, esterne sono "grayed" (da confermare, da admin o ad esempio se si accende secondo device utente entro 5/10 min) + * - le timbrature ext DOVREBBERO chiedere location (jScript?) e inviarla, visibile in conferma + * + * + * **********************************************/ // calcolo il secret... DateTime adesso = DateTime.Now; string Dominio = memLayer.ML.CRS("dominio"); @@ -482,8 +470,7 @@ namespace MapoDb { idx = memLayer.ML.IntSessionObj("MatrOpr"); } - catch - { } + catch { } return idx; } set @@ -505,8 +492,7 @@ namespace MapoDb DS_applicazione.AnagraficaOperatoriRow oper = taOp.getByMatrOpr(MatrOpr)[0]; answ = string.Format("{0} {1}", oper.Cognome, oper.Nome); } - catch - { } + catch { } return answ; } } @@ -846,7 +832,6 @@ namespace MapoDb return answ; } - /// /// Processa registrazione di uno stream di dati LIVE da IOB /// @@ -975,7 +960,6 @@ namespace MapoDb return answ; } - /// /// Processa registrazione di un counter x una data macchina IOB /// @@ -1370,7 +1354,7 @@ namespace MapoDb /// public static string vetoSplitOdlMaccHash(string idxMacchina) { - return mHash(string.Format("VetoOdlMacc:{0}", idxMacchina)); + return mHash($"VetoOdlMacc:{idxMacchina}"); } /// /// Hash dati tabella AnagStati macchina @@ -1442,7 +1426,6 @@ namespace MapoDb #region gestione MSE - /// /// Dati MSE serializzati in REDIS (get/set) /// @@ -1506,8 +1489,7 @@ namespace MapoDb answ = memLayer.ML.redSaveHashDict(currHash, currTask); logger.lg.scriviLog($"Task ADD - idxMacchina: {idxMacchina} | taskKey: {taskKey.ToString()} | taskVal: {taskVal}"); } - catch - { } + catch { } return answ; } /// @@ -1529,8 +1511,7 @@ namespace MapoDb answ = memLayer.ML.redSaveHashDict(currHash, currTask); logger.lg.scriviLog($"Task REM - idxMacchina: {idxMacchina} | taskKey: {taskKey.ToString()}"); } - catch - { } + catch { } return answ; } @@ -1578,8 +1559,7 @@ namespace MapoDb currVal[taskKey] = taskVal; answ = memLayer.ML.redSaveHashDict(currHash, currVal); } - catch - { } + catch { } return answ; } /// @@ -1600,12 +1580,10 @@ namespace MapoDb memLayer.ML.redDelKey(currHash); answ = memLayer.ML.redSaveHashDict(currHash, currVal); } - catch - { } + catch { } return answ; } - #endregion #region gestione attrezzaggi @@ -1624,7 +1602,7 @@ namespace MapoDb if (string.IsNullOrEmpty(rawData)) { // registro VETO x altri split... 2 minuti - memLayer.ML.setRSV(redKey, $"Inizio SPLIT-ODL {DateTime.Now}", 120); + memLayer.ML.setRSV(redKey, $"Inizio SPLIT-ODL {DateTime.Now}", 300); // proseguo DS_ProdTempi.ODLDataTable currData = null; DateTime adesso = DateTime.Now; @@ -1895,8 +1873,7 @@ namespace MapoDb { answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "insEnabled")); } - catch - { } + catch { } } // ...oppure dritto su DB else @@ -1985,8 +1962,7 @@ namespace MapoDb saveCurrODL(idxMacchina, answ); } } - catch - { } + catch { } } return answ; } @@ -2037,8 +2013,7 @@ namespace MapoDb { answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "sLogEnabled")); } - catch - { } + catch { } } // ...oppure dritto su DB else @@ -2174,8 +2149,7 @@ namespace MapoDb saveCounter(idxMacchina, answ.ToString()); } } - catch - { } + catch { } } return answ; } @@ -2194,8 +2168,7 @@ namespace MapoDb { answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "Multi") == "1"); } - catch - { } + catch { } } // ...oppure dritto su DB else @@ -2209,7 +2182,6 @@ namespace MapoDb #region gestione State Machine Ingressi - /// /// Recupera (da DB) i dati della State Machine multi ingressi nel formato /// key: IdxMacchina @@ -2407,8 +2379,7 @@ namespace MapoDb { answ = mDatiMacchine(idxMacchina)[chiave]; } - catch - { } + catch { } return answ; } @@ -2418,7 +2389,6 @@ namespace MapoDb #region metodi spostati da MapoDB - /// /// restituisce il TempoCiclo effettivo (tecnico) della macchina /// @@ -2439,8 +2409,7 @@ namespace MapoDb tc = riga.TCAssegnato; } } - catch - { } + catch { } // imposto a 99'TC if (tc == 0) { @@ -2469,8 +2438,7 @@ namespace MapoDb needDB = true; } } - catch - { } + catch { } } // ...oppure segno richiesta DB... else @@ -2550,8 +2518,7 @@ namespace MapoDb // esecuzione in REDIS CodArticolo = datiMacc["CodArticolo"]; } - catch - { } + catch { } } // ...oppure dritto su DB else @@ -2616,8 +2583,7 @@ namespace MapoDb rigaTransIn.next_IdxMicroStato = next_idxMS; } } - catch - { } + catch { } } // ...oppure dritto su DB else @@ -3146,8 +3112,7 @@ namespace MapoDb { cont = Convert.ToInt32(contatore); } - catch - { } + catch { } // 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto if (memLayer.ML.CRB("disable_singleton")) { @@ -3237,8 +3202,7 @@ namespace MapoDb /// /// Elenco task ammessi (x IOB-WIN da eseguire...) /// -public enum taskType -{ +public enum taskType { /// /// Task nullo / fake /// @@ -3280,8 +3244,7 @@ public enum taskType /// sendWatchDogMes2Plc } -public enum tipoSelettore -{ +public enum tipoSelettore { articoli }