From c8e6c6ccb3da47a28cbde083f21c3cbb63ade748 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 17 Jul 2017 12:01:05 +0200 Subject: [PATCH] completata gestione "riprogrammazione intervento" x controlli NON conclusi... --- .vs/config/applicationhost.config | 2 +- GIM_dataLayer/DS_applicazione.xsd | 47 ++++++------ GIM_dataLayer/DS_applicazione.xss | 8 +-- GIM_dataLayer/DS_applicazione1.Designer.cs | 57 ++++++++++++++- GIM_dataLayer/mtzProgr.cs | 2 +- GIM_site/Appunti.txt | 23 +----- GIM_site/Web.config | 1 + .../WebUserControls/mod_dettInt_default.ascx | 16 ++++- .../mod_dettInt_default.ascx.cs | 71 ++++++++++++++++++- GIM_site/WebUserControls/mod_nextMtzPro.ascx | 5 +- .../WebUserControls/mod_nextMtzPro.ascx.cs | 22 +++--- 11 files changed, 186 insertions(+), 68 deletions(-) diff --git a/.vs/config/applicationhost.config b/.vs/config/applicationhost.config index 32fbbb6..271cefe 100644 --- a/.vs/config/applicationhost.config +++ b/.vs/config/applicationhost.config @@ -162,7 +162,7 @@ - + diff --git a/GIM_dataLayer/DS_applicazione.xsd b/GIM_dataLayer/DS_applicazione.xsd index 7763178..7957f47 100644 --- a/GIM_dataLayer/DS_applicazione.xsd +++ b/GIM_dataLayer/DS_applicazione.xsd @@ -1064,6 +1064,7 @@ FROM MtzProgPending + @@ -1970,6 +1971,7 @@ FROM v_mtzProgExp + @@ -2468,7 +2470,7 @@ FROM v_mtzProgExp - + @@ -2553,7 +2555,7 @@ FROM v_mtzProgExp - + @@ -2578,7 +2580,7 @@ FROM v_mtzProgExp - + @@ -2612,7 +2614,7 @@ FROM v_mtzProgExp - + @@ -2698,7 +2700,7 @@ FROM v_mtzProgExp - + @@ -2782,7 +2784,7 @@ FROM v_mtzProgExp - + @@ -2791,6 +2793,7 @@ FROM v_mtzProgExp + @@ -2904,22 +2907,22 @@ FROM v_mtzProgExp - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GIM_dataLayer/DS_applicazione.xss b/GIM_dataLayer/DS_applicazione.xss index be03d18..2cd6abf 100644 --- a/GIM_dataLayer/DS_applicazione.xss +++ b/GIM_dataLayer/DS_applicazione.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + @@ -13,11 +13,11 @@ - + - + @@ -31,7 +31,7 @@ - + diff --git a/GIM_dataLayer/DS_applicazione1.Designer.cs b/GIM_dataLayer/DS_applicazione1.Designer.cs index d6ed7cf..63bf6bc 100644 --- a/GIM_dataLayer/DS_applicazione1.Designer.cs +++ b/GIM_dataLayer/DS_applicazione1.Designer.cs @@ -10364,6 +10364,8 @@ namespace GIM_dataLayer { private global::System.Data.DataColumn columnidxLastOne; + private global::System.Data.DataColumn columnisRipr; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public MtzProg_ScadenzeDataTable() { @@ -10445,6 +10447,14 @@ namespace GIM_dataLayer { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn isRiprColumn { + get { + return this.columnisRipr; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] @@ -10482,7 +10492,7 @@ namespace GIM_dataLayer { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public MtzProg_ScadenzeRow AddMtzProg_ScadenzeRow(int idxIntPro, System.DateTime lastOne, System.DateTime scadProg, System.DateTime scadNat, int idxPending, int idxLastOne) { + public MtzProg_ScadenzeRow AddMtzProg_ScadenzeRow(int idxIntPro, System.DateTime lastOne, System.DateTime scadProg, System.DateTime scadNat, int idxPending, int idxLastOne, bool isRipr) { MtzProg_ScadenzeRow rowMtzProg_ScadenzeRow = ((MtzProg_ScadenzeRow)(this.NewRow())); object[] columnValuesArray = new object[] { idxIntPro, @@ -10490,7 +10500,8 @@ namespace GIM_dataLayer { scadProg, scadNat, idxPending, - idxLastOne}; + idxLastOne, + isRipr}; rowMtzProg_ScadenzeRow.ItemArray = columnValuesArray; this.Rows.Add(rowMtzProg_ScadenzeRow); return rowMtzProg_ScadenzeRow; @@ -10519,6 +10530,7 @@ namespace GIM_dataLayer { this.columnscadNat = base.Columns["scadNat"]; this.columnidxPending = base.Columns["idxPending"]; this.columnidxLastOne = base.Columns["idxLastOne"]; + this.columnisRipr = base.Columns["isRipr"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10536,12 +10548,15 @@ namespace GIM_dataLayer { base.Columns.Add(this.columnidxPending); this.columnidxLastOne = new global::System.Data.DataColumn("idxLastOne", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnidxLastOne); + this.columnisRipr = new global::System.Data.DataColumn("isRipr", typeof(bool), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnisRipr); this.columnidxIntPro.ReadOnly = true; this.columnlastOne.ReadOnly = true; this.columnscadProg.ReadOnly = true; this.columnscadNat.ReadOnly = true; this.columnidxPending.ReadOnly = true; this.columnidxLastOne.ReadOnly = true; + this.columnisRipr.ReadOnly = true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -15496,6 +15511,22 @@ namespace GIM_dataLayer { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool isRipr { + get { + try { + return ((bool)(this[this.tableMtzProg_Scadenze.isRiprColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("Il valore della colonna \'isRipr\' nella tabella \'MtzProg_Scadenze\' è DBNull.", e); + } + } + set { + this[this.tableMtzProg_Scadenze.isRiprColumn] = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool IsidxIntProNull() { @@ -15567,6 +15598,18 @@ namespace GIM_dataLayer { public void SetidxLastOneNull() { this[this.tableMtzProg_Scadenze.idxLastOneColumn] = global::System.Convert.DBNull; } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsisRiprNull() { + return this.IsNull(this.tableMtzProg_Scadenze.isRiprColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetisRiprNull() { + this[this.tableMtzProg_Scadenze.isRiprColumn] = global::System.Convert.DBNull; + } } /// @@ -21166,6 +21209,7 @@ namespace GIM_dataLayer.DS_applicazioneTableAdapters { 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("@idxPending", 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("@newDate", 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("@isRipr", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -21230,7 +21274,7 @@ namespace GIM_dataLayer.DS_applicazioneTableAdapters { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] - public virtual DS_applicazione.MtzProgPendingDataTable updDataScad(global::System.Nullable idxPending, global::System.Nullable newDate) { + public virtual DS_applicazione.MtzProgPendingDataTable updDataScad(global::System.Nullable idxPending, global::System.Nullable newDate, global::System.Nullable isRipr) { this.Adapter.SelectCommand = this.CommandCollection[3]; if ((idxPending.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((int)(idxPending.Value)); @@ -21244,6 +21288,12 @@ namespace GIM_dataLayer.DS_applicazioneTableAdapters { else { this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value; } + if ((isRipr.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[3].Value = ((bool)(isRipr.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value; + } DS_applicazione.MtzProgPendingDataTable dataTable = new DS_applicazione.MtzProgPendingDataTable(); this.Adapter.Fill(dataTable); return dataTable; @@ -25960,6 +26010,7 @@ namespace GIM_dataLayer.DS_applicazioneTableAdapters { tableMapping.ColumnMappings.Add("scadNat", "scadNat"); tableMapping.ColumnMappings.Add("idxPending", "idxPending"); tableMapping.ColumnMappings.Add("idxLastOne", "idxLastOne"); + tableMapping.ColumnMappings.Add("isRipr", "isRipr"); this._adapter.TableMappings.Add(tableMapping); } diff --git a/GIM_dataLayer/mtzProgr.cs b/GIM_dataLayer/mtzProgr.cs index f8b58e5..b52f941 100644 --- a/GIM_dataLayer/mtzProgr.cs +++ b/GIM_dataLayer/mtzProgr.cs @@ -79,7 +79,7 @@ public class mtzProgr nextDate = nextDate.AddYears(rigaTemp.cadenza); break; } - taMtzPend.updDataScad(numIntMtzPend, nextDate); + taMtzPend.updDataScad(numIntMtzPend, nextDate, false); logger.lg.scriviLog(string.Format("Generata nuova scadenza di manutenzione (programmata) num {0} alla data {1}", numIntMtzPend, nextDate), tipoLog.INFO); } else diff --git a/GIM_site/Appunti.txt b/GIM_site/Appunti.txt index e14ab06..5f28270 100644 --- a/GIM_site/Appunti.txt +++ b/GIM_site/Appunti.txt @@ -1,22 +1 @@ - --------------------------------- ---- NUOVE --------------------------------- - - -- possibilità (SOLO x le manutenzioni programmate) di chiudere con un "riprogrammata", ovvero - * se ho un intervento tipicamente di "verifica e sostituzione" - * ho preso in carico, e fatta verifica (e quindi viene programmato prossimo intervento secondo solita scadenza) - * se dopo la verifica vedo che NON serve la sostituzione - * se "stile entratico" voglio chiudere ma DEVO rifare verifica... -avrò un pulsante speciale di "riprogramma alla data" (default: tra 2 settimane? tu scegli quanto andare avanti come default... sarà comunque modificabile da utente) che - * inserisce DA SOLO la nota (ad esempio) "verifica effettuata, riprogrammato alla data 26/07/2017" - * SALVA E CHIUDE QUESTO INTERVENTO - * ELIMINA INTERVENTO programmato tra 6 mesi E NE INSERISCE UNO tra 14 gg con un testo in cui metto IN AGGIUNTA ALL'INIZIO "RIPROGRAMMATO da num xxx del 12.07.2017" - - - - -per cui A PARTIRE dal 26.07.2017 verrà generato l'intervento... che dato il primo punto POTREBBE VENIRE COMUNQUE ANTICIPATO - -...alla chiusura dell'intervento verrà comunque fatta la verifica di "coerenza delle scadenze" per cui richiesto eventuale riprogrammazione delle scadenze future secondo quanto già indicato sopra \ No newline at end of file + \ No newline at end of file diff --git a/GIM_site/Web.config b/GIM_site/Web.config index 7adc026..0a59880 100644 --- a/GIM_site/Web.config +++ b/GIM_site/Web.config @@ -100,6 +100,7 @@ + diff --git a/GIM_site/WebUserControls/mod_dettInt_default.ascx b/GIM_site/WebUserControls/mod_dettInt_default.ascx index 69efd8e..6ea9fea 100644 --- a/GIM_site/WebUserControls/mod_dettInt_default.ascx +++ b/GIM_site/WebUserControls/mod_dettInt_default.ascx @@ -9,7 +9,7 @@ <%@ Register Src="~/WebUserControls/mod_fileUpload.ascx" TagPrefix="uc1" TagName="mod_fileUpload" %> <%@ Register Src="~/WebUserControls/mod_nextMtzPro.ascx" TagPrefix="uc1" TagName="mod_nextMtzPro" %> - +
@@ -178,7 +178,19 @@
- +
+
+ +
+
+ + <%# traduci("ReschMtzProg") %> + +
+
+ +
+
diff --git a/GIM_site/WebUserControls/mod_dettInt_default.ascx.cs b/GIM_site/WebUserControls/mod_dettInt_default.ascx.cs index c741973..3e9cf99 100644 --- a/GIM_site/WebUserControls/mod_dettInt_default.ascx.cs +++ b/GIM_site/WebUserControls/mod_dettInt_default.ascx.cs @@ -1,4 +1,6 @@ -using System; +using GIM_dataLayer; +using SteamWare; +using System; using System.Web.UI.WebControls; namespace GIM_site.WebUserControls @@ -55,5 +57,72 @@ namespace GIM_site.WebUserControls { raiseEventUpd(); } + /// + /// Verifica se sia possibile rischedulare intervento (deve essere ULTIMO della serie di mtz programmata...) + /// + /// + /// + public bool checkResch(object _numInt, object _scheduled) + { + bool answ = false; + try + { + bool scheduled = Convert.ToBoolean(_scheduled); + if (scheduled) + { + int numMtz = Convert.ToInt32(_numInt); + // in primis: VERIFICO se sia ultimo della serie... + answ = true; + } + } + catch + { } + return answ; + } + + public int numIntMtz + { + get + { + int answ = 0; + try + { + answ = memLayer.ML.QSI("numIntMtz"); + } + catch + { } + return answ; + } + } + + protected void frmView_default_ItemUpdating(object sender, FormViewUpdateEventArgs e) + { + // se è rischedula mi fermo... + if (e.CommandArgument.ToString() == "Reschedule") + { + try + { + // salvo record corrente con nota rischedulazione alla data + DS_applicazione.v_intervExpDataTable tab = TA_app.obj.taInterventiMtz.getByIdx(numIntMtz); + if (tab.Rows.Count > 0) + { + int idxStChiuso = 3; + DS_applicazione.v_intervExpRow riga = tab[0]; + FormView frm = (FormView)sender; + mod_dataOra dataOra = (mod_dataOra)frm.FindControl("dtDataRisc"); + DateTime newData = dataOra.valore; + string notaRisched = string.Format("{0} {1:yyyy.MM.dd}", traduci("notaRiscIntMtzPro"), newData); + TA_app.obj.taInterventiMtz.updateIntervento(numIntMtz, idxStChiuso, riga.inizioIntervento, DateTime.Now, riga.isPreventivabile, notaRisched, riga.isFermo, riga.isExt, riga.idxAmbito, riga.idxCausale); + e.Cancel = true; + // ...sposto intervento alla data schedulata... + DS_applicazione.MtzProg_ScadenzeDataTable tabMtzProg = TA_app.obj.taScadenze.GetData(riga.idxIntPro); + mtzProgr.obj.taMtzPend.updDataScad(tabMtzProg[0].idxPending, newData, true); + } + } + catch + { } + } + raiseEventUpd(); + } } } \ No newline at end of file diff --git a/GIM_site/WebUserControls/mod_nextMtzPro.ascx b/GIM_site/WebUserControls/mod_nextMtzPro.ascx index f1a90a8..e32289d 100644 --- a/GIM_site/WebUserControls/mod_nextMtzPro.ascx +++ b/GIM_site/WebUserControls/mod_nextMtzPro.ascx @@ -12,16 +12,13 @@
- + <%: traduci("doReschedule") %>
<%: traduci("goToIntProDone") %> - <%----%> - <%--<%: "IDX: " + idxIntPro.ToString() %>--%> - <%----%>
<%: traduci("ScadProgr") %>:
diff --git a/GIM_site/WebUserControls/mod_nextMtzPro.ascx.cs b/GIM_site/WebUserControls/mod_nextMtzPro.ascx.cs index 3a063b0..253f1b9 100644 --- a/GIM_site/WebUserControls/mod_nextMtzPro.ascx.cs +++ b/GIM_site/WebUserControls/mod_nextMtzPro.ascx.cs @@ -39,20 +39,26 @@ namespace GIM_site.WebUserControls /// /// Verifica se le 2 date siano coerenti con programmazione (true) altrimenti indica problemi (false) /// - /// - /// + /// Scadenza programmata + /// Scadenza naturale + /// Già riprogrammato (tipicamente dopo verifica negativa da rivedere) /// - public bool checkDate(object _scadProg, object _scadNat) + public bool checkDate(object _scadProg, object _scadNat, object _isRipr) { bool answ = false; DateTime scadProg = DateTime.Today; DateTime scadNat = DateTime.Today; + bool isRipr = false; try { - scadProg = Convert.ToDateTime(_scadProg); - scadNat = Convert.ToDateTime(_scadNat); - //answ = !(scadProg.Equals(scadNat)); - answ = Math.Abs(scadProg.Subtract(scadNat).TotalDays) > memLayer.ML.CRI("maxGgTolleranzaScadProg"); + isRipr = Convert.ToBoolean(_isRipr); + if (!isRipr) + { + scadProg = Convert.ToDateTime(_scadProg); + scadNat = Convert.ToDateTime(_scadNat); + //answ = !(scadProg.Equals(scadNat)); + answ = Math.Abs(scadProg.Subtract(scadNat).TotalDays) > memLayer.ML.CRI("maxGgTolleranzaScadProg"); + } } catch { } @@ -66,7 +72,7 @@ namespace GIM_site.WebUserControls { if (tab.Rows.Count > 0) { - mtzProgr.obj.taMtzPend.updDataScad(tab[0].idxPending, tab[0].scadNat); + mtzProgr.obj.taMtzPend.updDataScad(tab[0].idxPending, tab[0].scadNat, false); lstView.DataBind(); } }