From 58b227729f11f66c2301283a970d72cfb1b04422 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 26 Sep 2018 19:15:02 +0200 Subject: [PATCH] Completata gestione editing PromessaODL (anche con BCode) --- Jenkinsfile | 2 +- MP-Admin/WebUserControls/mod_gestPromODL.ascx | 3 +- .../WebUserControls/mod_gestPromODL.ascx.cs | 10 ++ .../WebUserControls/mod_newPromessaODL.ascx | 4 +- .../mod_newPromessaODL.ascx.cs | 102 +++++++++++----- MapoDb/DS_ProdTempi.Designer.cs | 113 +++++++++++++++++- MapoDb/DS_ProdTempi.xsd | 40 +++++-- MapoDb/DS_ProdTempi.xss | 2 +- 8 files changed, 228 insertions(+), 48 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 131ecc08..6c733369 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=830']) { + withEnv(['NEXT_BUILD_NUMBER=831']) { // env.versionNumber = VersionNumber(versionNumberString : '6.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '6.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO' diff --git a/MP-Admin/WebUserControls/mod_gestPromODL.ascx b/MP-Admin/WebUserControls/mod_gestPromODL.ascx index 9aa40ba9..d8124dda 100644 --- a/MP-Admin/WebUserControls/mod_gestPromODL.ascx +++ b/MP-Admin/WebUserControls/mod_gestPromODL.ascx @@ -51,10 +51,9 @@ - <%----%> - + diff --git a/MP-Admin/WebUserControls/mod_gestPromODL.ascx.cs b/MP-Admin/WebUserControls/mod_gestPromODL.ascx.cs index 52d66cba..804fdabc 100644 --- a/MP-Admin/WebUserControls/mod_gestPromODL.ascx.cs +++ b/MP-Admin/WebUserControls/mod_gestPromODL.ascx.cs @@ -71,6 +71,7 @@ namespace MoonProAdmin.WebUserControls // salvo in session il valore selezionato... memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); bool doClone = false; + bool doEdit = false; // gestione buttons richieste string _comando = ""; if (memLayer.ML.isInSessionObject("nextObjCommand")) @@ -83,6 +84,9 @@ namespace MoonProAdmin.WebUserControls case "Clona": doClone = true; break; + case "Edit": + doEdit = true; + break; default: break; } @@ -92,6 +96,12 @@ namespace MoonProAdmin.WebUserControls showAddNewPODL(); mod_newPromessaODL.doSelPODL(); } + else if (doEdit) + { + memLayer.ML.setSessionVal("idxProm2Edit", grView.SelectedValue, false); + showAddNewPODL(); + mod_newPromessaODL.doSelPODL(); + } else { // mostro edit quantità... diff --git a/MP-Admin/WebUserControls/mod_newPromessaODL.ascx b/MP-Admin/WebUserControls/mod_newPromessaODL.ascx index 2a7c5828..4d6133dc 100644 --- a/MP-Admin/WebUserControls/mod_newPromessaODL.ascx +++ b/MP-Admin/WebUserControls/mod_newPromessaODL.ascx @@ -105,10 +105,10 @@  
- Crea Promessa ODL + <%: testoConf %>
-
+
 
diff --git a/MP-Admin/WebUserControls/mod_newPromessaODL.ascx.cs b/MP-Admin/WebUserControls/mod_newPromessaODL.ascx.cs index 978c8d88..dbcab871 100644 --- a/MP-Admin/WebUserControls/mod_newPromessaODL.ascx.cs +++ b/MP-Admin/WebUserControls/mod_newPromessaODL.ascx.cs @@ -14,41 +14,63 @@ namespace MoonProAdmin.WebUserControls setDefaults(); } } + /// + /// Testo conferma salvataggio (create/Edit) + /// + public string testoConf + { + get + { + string answ = "Crea Promessa ODL"; + if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + answ = "Edit Promessa ODL"; + } + return answ; + } + } public void doSelPODL() { // se ho una promessa da clonare copio dati da quella... + int idxProm = 0; + if (memLayer.ML.isInSessionObject("idxProm2Clone")) { - int idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); - var tPODL = DataLayer.obj.taPODL.getByKey(idxProm); - if (tPODL.Rows.Count > 0) + idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); + } + else if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + } + // provo a selezionare + var tPODL = DataLayer.obj.taPODL.getByKey(idxProm); + if (tPODL.Rows.Count > 0) + { + var rPODL = tPODL[0]; + txtSearch.Text = rPODL.CodArticolo; + ddlArticolo.DataBind(); + ddlGruppi.DataBind(); + ddlGruppi.SelectedValue = rPODL.CodGruppo; + txtNumPz.Text = rPODL.NumPezzi.ToString(); + txtPzPallet.Text = rPODL.PzPallet.ToString(); + txtPrio.Text = rPODL.Priorita.ToString(); + int min = 0; + int sec = 0; + string TC_MinSec = ""; + try { - var rPODL = tPODL[0]; - txtSearch.Text = rPODL.CodArticolo; - ddlArticolo.DataBind(); - ddlGruppi.DataBind(); - ddlGruppi.SelectedValue = rPODL.CodGruppo; - txtNumPz.Text = rPODL.NumPezzi.ToString(); - txtPzPallet.Text = rPODL.PzPallet.ToString(); - txtPrio.Text = rPODL.Priorita.ToString(); - int min = 0; - int sec = 0; - string TC_MinSec = ""; - try - { - // cerco di convertire in min/sec - min = Convert.ToInt32(Math.Floor(Convert.ToDouble(rPODL.TCAssegnato))); - sec = Convert.ToInt32((Convert.ToDouble(rPODL.TCAssegnato) - min) * 60); - TC_MinSec = string.Format("{0}:{1:00}", min, sec); - } - catch - { } - txtTC.Text = TC_MinSec; - ddlMacchine.SelectedValue = rPODL.IdxMacchina; - txtKeyExt.Text = rPODL.KeyRichiesta; - // svuoto... - memLayer.ML.emptySessionVal("idxProm2Clone"); + // cerco di convertire in min/sec + min = Convert.ToInt32(Math.Floor(Convert.ToDouble(rPODL.TCAssegnato))); + sec = Convert.ToInt32((Convert.ToDouble(rPODL.TCAssegnato) - min) * 60); + TC_MinSec = string.Format("{0}:{1:00}", min, sec); } + catch + { } + txtTC.Text = TC_MinSec; + ddlMacchine.SelectedValue = rPODL.IdxMacchina; + txtKeyExt.Text = rPODL.KeyRichiesta; + // svuoto se ci fosse cloning...... + memLayer.ML.emptySessionVal("idxProm2Clone"); } } @@ -61,6 +83,8 @@ namespace MoonProAdmin.WebUserControls txtPzPallet.Text = "1"; txtPrio.Text = "1"; txtTC.Text = "1:00"; + memLayer.ML.emptySessionVal("idxProm2Clone"); + memLayer.ML.emptySessionVal("idxProm2Edit"); } } @@ -115,13 +139,25 @@ namespace MoonProAdmin.WebUserControls pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim()); attiv = chkAttiv.Checked; int.TryParse(txtPrio.Text, out prio); - // 2018.09.25 --> inserisco PROMESSA ODL - //MapoDb.DataLayer.obj.taODL.InsertQuery(CodArticolo, MapoDb.DataLayer.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); - MapoDb.DataLayer.obj.taPODL.insertQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet); + + // controllo se sono in modalità EDIT faccio un update, altrimenti faccio un INSERT... + if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + int idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + DataLayer.obj.taPODL.updateQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet, idxProm); + memLayer.ML.emptySessionVal("idxProm2Edit"); + } + else + { + // 2018.09.25 --> inserisco PROMESSA ODL + //MapoDb.DataLayer.obj.taODL.InsertQuery(CodArticolo, MapoDb.DataLayer.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); + DataLayer.obj.taPODL.insertQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet); + } } catch (Exception exc) { - logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire la PromessaODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7}{8}{9}", KeyReq, attiv, CodArticolo, IdxMacchina, numPezzi, TCiclo, prio, pzPallet, Environment.NewLine, exc), tipoLog.EXCEPTION); + logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire la PromessaODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}{9}{10}", KeyReq, attiv, CodArticolo, IdxMacchina, numPezzi, TCiclo, prio, pzPallet, memLayer.ML.IntSessionObj("idxProm2Edit"), Environment.NewLine, exc), tipoLog.EXCEPTION); + memLayer.ML.emptySessionVal("idxProm2Edit"); } // segnalo update if (eh_nuovoValore != null) @@ -136,6 +172,8 @@ namespace MoonProAdmin.WebUserControls /// protected void btnCancel_Click(object sender, EventArgs e) { + memLayer.ML.emptySessionVal("idxProm2Clone"); + memLayer.ML.emptySessionVal("idxProm2Edit"); if (eh_nuovoValore != null) { eh_nuovoValore(this, new EventArgs()); diff --git a/MapoDb/DS_ProdTempi.Designer.cs b/MapoDb/DS_ProdTempi.Designer.cs index f440bdf6..8fa436cd 100644 --- a/MapoDb/DS_ProdTempi.Designer.cs +++ b/MapoDb/DS_ProdTempi.Designer.cs @@ -26985,7 +26985,7 @@ FROM MappaStatoExpl"; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[5]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[6]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT idxPromessa, KeyRichiesta, KeyBCode, Attivabile, IdxODL, CodArticolo, Desc" + @@ -27028,6 +27028,23 @@ FROM MappaStatoExpl"; this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumPezzi", 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("@PzPallet", 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("@Original_idxPromessa", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[5].Connection = this.Connection; + this._commandCollection[5].CommandText = "dbo.stp_PODL_updateQuery"; + this._commandCollection[5].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[5].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[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@KeyRichiesta", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@KeyBCode", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Attivabile", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodArticolo", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodGruppo", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].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[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumPezzi", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TCAssegnato", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 8, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DueDate", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Priorita", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PzPallet", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_idxPromessa", 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()] @@ -27226,6 +27243,100 @@ FROM MappaStatoExpl"; } return returnValue; } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int updateQuery(string KeyRichiesta, string KeyBCode, global::System.Nullable Attivabile, string CodArticolo, string CodGruppo, string IdxMacchina, global::System.Nullable NumPezzi, global::System.Nullable TCAssegnato, global::System.Nullable DueDate, global::System.Nullable Priorita, global::System.Nullable PzPallet, global::System.Nullable Original_idxPromessa) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[5]; + if ((KeyRichiesta == null)) { + command.Parameters[1].Value = global::System.DBNull.Value; + } + else { + command.Parameters[1].Value = ((string)(KeyRichiesta)); + } + if ((KeyBCode == null)) { + command.Parameters[2].Value = global::System.DBNull.Value; + } + else { + command.Parameters[2].Value = ((string)(KeyBCode)); + } + if ((Attivabile.HasValue == true)) { + command.Parameters[3].Value = ((bool)(Attivabile.Value)); + } + else { + command.Parameters[3].Value = global::System.DBNull.Value; + } + if ((CodArticolo == null)) { + command.Parameters[4].Value = global::System.DBNull.Value; + } + else { + command.Parameters[4].Value = ((string)(CodArticolo)); + } + if ((CodGruppo == null)) { + command.Parameters[5].Value = global::System.DBNull.Value; + } + else { + command.Parameters[5].Value = ((string)(CodGruppo)); + } + if ((IdxMacchina == null)) { + command.Parameters[6].Value = global::System.DBNull.Value; + } + else { + command.Parameters[6].Value = ((string)(IdxMacchina)); + } + if ((NumPezzi.HasValue == true)) { + command.Parameters[7].Value = ((int)(NumPezzi.Value)); + } + else { + command.Parameters[7].Value = global::System.DBNull.Value; + } + if ((TCAssegnato.HasValue == true)) { + command.Parameters[8].Value = ((decimal)(TCAssegnato.Value)); + } + else { + command.Parameters[8].Value = global::System.DBNull.Value; + } + if ((DueDate.HasValue == true)) { + command.Parameters[9].Value = ((System.DateTime)(DueDate.Value)); + } + else { + command.Parameters[9].Value = global::System.DBNull.Value; + } + if ((Priorita.HasValue == true)) { + command.Parameters[10].Value = ((int)(Priorita.Value)); + } + else { + command.Parameters[10].Value = global::System.DBNull.Value; + } + if ((PzPallet.HasValue == true)) { + command.Parameters[11].Value = ((int)(PzPallet.Value)); + } + else { + command.Parameters[11].Value = global::System.DBNull.Value; + } + if ((Original_idxPromessa.HasValue == true)) { + command.Parameters[12].Value = ((int)(Original_idxPromessa.Value)); + } + else { + command.Parameters[12].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; + } } /// diff --git a/MapoDb/DS_ProdTempi.xsd b/MapoDb/DS_ProdTempi.xsd index 4f80fd73..261a2544 100644 --- a/MapoDb/DS_ProdTempi.xsd +++ b/MapoDb/DS_ProdTempi.xsd @@ -2150,6 +2150,28 @@ ORDER BY idxPromessa DESC + + + + dbo.stp_PODL_updateQuery + + + + + + + + + + + + + + + + + + @@ -2573,7 +2595,7 @@ ORDER BY idxPromessa DESC - + @@ -2654,7 +2676,7 @@ ORDER BY idxPromessa DESC - + @@ -2683,7 +2705,7 @@ ORDER BY idxPromessa DESC - + @@ -2695,7 +2717,7 @@ ORDER BY idxPromessa DESC - + @@ -2720,7 +2742,7 @@ ORDER BY idxPromessa DESC - + @@ -2758,7 +2780,7 @@ ORDER BY idxPromessa DESC - + @@ -2797,7 +2819,7 @@ ORDER BY idxPromessa DESC - + @@ -2863,7 +2885,7 @@ ORDER BY idxPromessa DESC - + @@ -2885,7 +2907,7 @@ ORDER BY idxPromessa DESC - + diff --git a/MapoDb/DS_ProdTempi.xss b/MapoDb/DS_ProdTempi.xss index 986a53d3..4c6406ee 100644 --- a/MapoDb/DS_ProdTempi.xss +++ b/MapoDb/DS_ProdTempi.xss @@ -14,7 +14,7 @@ - +