From 507d515fbb60d678bec649acd1d6550cd760cfb7 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 9 Mar 2020 17:57:13 +0100 Subject: [PATCH 1/3] Minor fix x formattazione... --- MapoDb/DataLayer.cs | 121 +++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 79 deletions(-) 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 } From f4c36a9ba7417a9b8eee56411c4aba0f5a47fcab Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 10 Mar 2020 17:02:38 +0100 Subject: [PATCH 2/3] Nuova versione x modifica conf pezzi --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 064ec375..715c92e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=1291']) { + withEnv(['NEXT_BUILD_NUMBER=1292']) { // env.versionNumber = VersionNumber(versionNumberString : '6.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '6.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO' From 140e9270b36c1ac356b654a3c1d7bd7c11fa290d Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 10 Mar 2020 17:03:37 +0100 Subject: [PATCH 3/3] Aggiunta stored conf nuova con pezzi lasciati ed evento 121 --- MP-TAB/WebUserControls/mod_confProd.ascx.cs | 64 +++++++----- MapoDb/DS_ProdTempi.cs | 6 +- MapoDb/DS_ProdTempi.xsd | 38 +++++-- MapoDb/DS_ProdTempi.xss | 16 +-- MapoDb/DS_ProdTempi1.Designer.cs | 109 ++++++++++++++++++-- MapoDb/DataLayer.cs | 30 +++++- 6 files changed, 207 insertions(+), 56 deletions(-) diff --git a/MP-TAB/WebUserControls/mod_confProd.ascx.cs b/MP-TAB/WebUserControls/mod_confProd.ascx.cs index 4ceeeb91..67f161d7 100644 --- a/MP-TAB/WebUserControls/mod_confProd.ascx.cs +++ b/MP-TAB/WebUserControls/mod_confProd.ascx.cs @@ -7,6 +7,10 @@ namespace MoonProTablet.WebUserControls { public partial class mod_confProd : System.Web.UI.UserControl { + /// + /// indica conferma con rettifica (evento 121) + /// + protected bool confRett = memLayer.ML.CRB("confRett"); /// /// Oggetto datalayer specifico /// @@ -396,14 +400,8 @@ namespace MoonProTablet.WebUserControls /// protected void lbtSalva_Click(object sender, EventArgs e) { - if (memLayer.ML.CRI("modoConfProd") == 2) - { - confermaPerTurni(); - } - else - { - confermaPerGiorni(); - } + // effettua conferma con conf da DB del tipo (giorni / turni / periodo + bool fatto = effettuaConfermaProd(); // refresh tabella dati tablet... DataLayerObj.taMSE.forceRecalc(0, idxMacchina); // mostro output @@ -418,19 +416,23 @@ namespace MoonProTablet.WebUserControls doUpdate(); } /// - /// effettua conferma per giorni della produzione + /// Registra conferma produzione in modalità nuova (con rettifica pezzi lasciati) o legacy (con anticipo periodo) /// - private void confermaPerGiorni() + private bool effettuaConfermaProd() { - DataLayerObj.confermaProdMacchina(idxMacchina, memLayer.ML.CRI("modoConfProd"), numPzConfermati, numPzScarto2Rec, dtReqUpdate); - } - /// - /// effettua conferma per turni della produzione - /// - private void confermaPerTurni() - { - DataLayerObj.confermaProdMacchina(idxMacchina, memLayer.ML.CRI("modoConfProd"), numPzConfermati, numPzScarto2Rec, dtReqUpdate); + bool fatto = false; + if (confRett) + { + // confermo al netto dei pezzi lasciati... + fatto = DataLayerObj.confermaProdMacchinaFull(idxMacchina, memLayer.ML.CRI("modoConfProd"), numPzConfermati - numPzLasciati, numPzLasciati, numPzScarto2Rec, dtReqUpdate); + } + else + { + fatto = DataLayerObj.confermaProdMacchina(idxMacchina, memLayer.ML.CRI("modoConfProd"), numPzConfermati, numPzScarto2Rec, dtReqUpdate); + } + return fatto; } + /// /// update post modifica pz buoni /// @@ -446,21 +448,29 @@ namespace MoonProTablet.WebUserControls /// private void updatePzBuoni() { - // se ho dei pezzi lasciati RICALCOLO la data... - if (numPzLasciati > 0) + if (confRett) { - // calcolo la data.. - DS_ProdTempi.TempiCicloRilevatiDataTable tab = DataLayerObj.taTempiCicloRilevati.getLastPzByMaccQta(idxMacchina, DateTime.Now, numPzLasciati); - if (tab.Rows.Count > 0) + // cambio le qta di pezzi confermati... + lblPz2RecBuoni.Text = (numPzConfermati - numPzLasciati).ToString(); + } + else + { + // se ho dei pezzi lasciati RICALCOLO la data... + if (numPzLasciati > 0) { - dtReqUpdate = tab[0].DataOraRif.AddSeconds(1); + // calcolo la data.. + DS_ProdTempi.TempiCicloRilevatiDataTable tab = DataLayerObj.taTempiCicloRilevati.getLastPzByMaccQta(idxMacchina, DateTime.Now, numPzLasciati); + if (tab.Rows.Count > 0) + { + dtReqUpdate = tab[0].DataOraRif.AddSeconds(1); + } + // aggiorno + doUpdate(); } - // aggiorno - doUpdate(); + lblPz2RecBuoni.Text = numPzConfermati.ToString(); } // aggiorno la data calcolo + pezzi buoni... lblDtRec.Text = dtReqUpdate.ToString(); - lblPz2RecBuoni.Text = numPzConfermati.ToString(); } /// /// Update pz lasciati --> aggiorno! diff --git a/MapoDb/DS_ProdTempi.cs b/MapoDb/DS_ProdTempi.cs index 5c73d281..6a9fe667 100644 --- a/MapoDb/DS_ProdTempi.cs +++ b/MapoDb/DS_ProdTempi.cs @@ -11,7 +11,7 @@ namespace MapoDb { - public partial class DS_ProdTempi - { - } + public partial class DS_ProdTempi + { + } } diff --git a/MapoDb/DS_ProdTempi.xsd b/MapoDb/DS_ProdTempi.xsd index 9057e94b..6ee527fb 100644 --- a/MapoDb/DS_ProdTempi.xsd +++ b/MapoDb/DS_ProdTempi.xsd @@ -890,6 +890,26 @@ SELECT IdxPostazione, DescPostazione, IdxMacchina, MatrOperatore, InputUntil, La + + + + dbo.stp_ConfermaProduzCompletaFull + + + + + + + + + + + + + + + + @@ -2767,7 +2787,7 @@ FROM v_ECP - + @@ -2848,7 +2868,7 @@ FROM v_ECP - + @@ -2860,7 +2880,7 @@ FROM v_ECP - + @@ -2885,7 +2905,7 @@ FROM v_ECP - + @@ -2923,7 +2943,7 @@ FROM v_ECP - + @@ -2962,7 +2982,7 @@ FROM v_ECP - + @@ -3028,7 +3048,7 @@ FROM v_ECP - + @@ -3105,7 +3125,7 @@ FROM v_ECP - + @@ -3140,7 +3160,7 @@ FROM v_ECP - + diff --git a/MapoDb/DS_ProdTempi.xss b/MapoDb/DS_ProdTempi.xss index 288d1390..83b05229 100644 --- a/MapoDb/DS_ProdTempi.xss +++ b/MapoDb/DS_ProdTempi.xss @@ -4,29 +4,29 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - + - + - + - + - + - + - + diff --git a/MapoDb/DS_ProdTempi1.Designer.cs b/MapoDb/DS_ProdTempi1.Designer.cs index 5e679db3..035d6959 100644 --- a/MapoDb/DS_ProdTempi1.Designer.cs +++ b/MapoDb/DS_ProdTempi1.Designer.cs @@ -19783,7 +19783,7 @@ SELECT IdxPostazione, DescPostazione, IdxMacchina, MatrOperatore, InputUntil, La [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[4]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[5]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "dbo.stp_PzProd_getByMacchina"; @@ -19814,17 +19814,32 @@ SELECT IdxPostazione, DescPostazione, IdxMacchina, MatrOperatore, InputUntil, La this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TestConferma", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[3].Connection = this.Connection; - this._commandCollection[3].CommandText = "dbo.stp_DatiConf_conferma"; + this._commandCollection[3].CommandText = "dbo.stp_ConfermaProduzCompletaFull"; this._commandCollection[3].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxODL", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxMacchina", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatrApp", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataFrom", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataTo", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@turno", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxStato", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pezziConf", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pezziLasciati", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pezziScar", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TipoConf", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DataOraApp", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TestConferma", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[4].Connection = this.Connection; + this._commandCollection[4].CommandText = "dbo.stp_DatiConf_conferma"; + this._commandCollection[4].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxODL", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxMacchina", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatrApp", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataFrom", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataTo", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@turno", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxStato", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pezziConf", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19971,8 +19986,90 @@ SELECT IdxPostazione, DescPostazione, IdxMacchina, MatrOperatore, InputUntil, La [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int stp_DatiConf_conferma(global::System.Nullable idxODL, string idxMacchina, global::System.Nullable MatrApp, global::System.Nullable dataFrom, global::System.Nullable dataTo, global::System.Nullable turno, global::System.Nullable idxStato, global::System.Nullable pezziConf) { + public virtual int stp_ConfermaProduzCompletaFull(string idxMacchina, global::System.Nullable MatrApp, global::System.Nullable dataFrom, global::System.Nullable dataTo, global::System.Nullable pezziConf, global::System.Nullable pezziLasciati, global::System.Nullable pezziScar, global::System.Nullable TipoConf, global::System.Nullable DataOraApp, global::System.Nullable TestConferma) { global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[3]; + if ((idxMacchina == null)) { + command.Parameters[1].Value = global::System.DBNull.Value; + } + else { + command.Parameters[1].Value = ((string)(idxMacchina)); + } + if ((MatrApp.HasValue == true)) { + command.Parameters[2].Value = ((int)(MatrApp.Value)); + } + else { + command.Parameters[2].Value = global::System.DBNull.Value; + } + if ((dataFrom.HasValue == true)) { + command.Parameters[3].Value = ((System.DateTime)(dataFrom.Value)); + } + else { + command.Parameters[3].Value = global::System.DBNull.Value; + } + if ((dataTo.HasValue == true)) { + command.Parameters[4].Value = ((System.DateTime)(dataTo.Value)); + } + else { + command.Parameters[4].Value = global::System.DBNull.Value; + } + if ((pezziConf.HasValue == true)) { + command.Parameters[5].Value = ((int)(pezziConf.Value)); + } + else { + command.Parameters[5].Value = global::System.DBNull.Value; + } + if ((pezziLasciati.HasValue == true)) { + command.Parameters[6].Value = ((int)(pezziLasciati.Value)); + } + else { + command.Parameters[6].Value = global::System.DBNull.Value; + } + if ((pezziScar.HasValue == true)) { + command.Parameters[7].Value = ((int)(pezziScar.Value)); + } + else { + command.Parameters[7].Value = global::System.DBNull.Value; + } + if ((TipoConf.HasValue == true)) { + command.Parameters[8].Value = ((int)(TipoConf.Value)); + } + else { + command.Parameters[8].Value = global::System.DBNull.Value; + } + if ((DataOraApp.HasValue == true)) { + command.Parameters[9].Value = ((System.DateTime)(DataOraApp.Value)); + } + else { + command.Parameters[9].Value = global::System.DBNull.Value; + } + if ((TestConferma.HasValue == true)) { + command.Parameters[10].Value = ((bool)(TestConferma.Value)); + } + else { + command.Parameters[10].Value = global::System.DBNull.Value; + } + global::System.Data.ConnectionState previousConnectionState = command.Connection.State; + if (((command.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + command.Connection.Open(); + } + int returnValue; + try { + returnValue = command.ExecuteNonQuery(); + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + command.Connection.Close(); + } + } + return returnValue; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int stp_DatiConf_conferma(global::System.Nullable idxODL, string idxMacchina, global::System.Nullable MatrApp, global::System.Nullable dataFrom, global::System.Nullable dataTo, global::System.Nullable turno, global::System.Nullable idxStato, global::System.Nullable pezziConf) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[4]; if ((idxODL.HasValue == true)) { command.Parameters[1].Value = ((int)(idxODL.Value)); } diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index 3dff5571..07107e8c 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -309,17 +309,41 @@ namespace MapoDb DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd = taPzProd2conf.GetData(idxMacchina.ToString())[0]; // chiamo stored stp_ConfermaProduzCompleta(idxMacchina,MatrApp,dataFrom,dataTo,pezziConf) taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina, MatrOpr, rigaProd.DataFrom, DataOraApp, numPzConfermati, numPzScarto, modoConfProd, DataOraApp, true); - //taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina, MatrOpr, rigaProd.DataFrom, rigaProd.DataTo, numPzConfermati, numPzScarto, modoConfProd, DateTime.Now, true); // indico eseguito! answ = true; } catch (Exception exc) { - logger.lg.scriviLog(string.Format("Errore in conferma prod macchina:{0}{1}", Environment.NewLine, exc)); + logger.lg.scriviLog($"Errore in conferma prod macchina:{Environment.NewLine}{exc}"); + } + return answ; + } + /// + /// Effettua conferma prod macchina dell'intero periodo da confermare (ultima conferma --> adesso) + /// + /// idx macchina da confermare + /// 0=periodo, 1 = giorno, 2 = turno + /// qta pezzi BUONI da confermare + /// qta pezzi LASCIATI alla macchina da confermare (2 eventi 121 rettifica neg/pos) + /// qta pezzi SCARTO da confermare + /// DataOra in cui registrare approvazione + /// + public bool confermaProdMacchinaFull(string idxMacchina, int modoConfProd, int numPzConfermati, int numPzLasciati, int numPzScarto, DateTime DataOraApp) + { + bool answ = false; + try + { + DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd = taPzProd2conf.GetData(idxMacchina.ToString())[0]; + taPzProd2conf.stp_ConfermaProduzCompletaFull(idxMacchina, MatrOpr, rigaProd.DataFrom, DataOraApp, numPzConfermati, numPzLasciati, numPzScarto, modoConfProd, DataOraApp, true); + // indico eseguito! + answ = true; + } + catch (Exception exc) + { + logger.lg.scriviLog($"Errore in conferma prod macchina con rett ev121:{Environment.NewLine}{exc}"); } return answ; } - /// /// invia una mail al destinatario x linkare nuovi devices tramite URL ///