From b24fa4a94adfa35c66d4ddbcb3fe46de5d1d2620 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 15 Mar 2018 17:49:04 +0100 Subject: [PATCH] Update x gestione selezione singola macchina/tutte x ODL --- MP-Tablet/MP-Tablet.csproj | 18 ------- MP-Tablet/WebUserControls/mod_ODL.ascx | 19 +++++-- MP-Tablet/WebUserControls/mod_ODL.ascx.cs | 24 ++++++++- .../WebUserControls/mod_ODL.ascx.designer.cs | 18 +++++++ MapoDb/DS_Utility.Designer.cs | 11 +++- MapoDb/DS_Utility.xsd | 7 +-- MapoDb/DS_Utility.xss | 14 +++--- SQL Utils/SqlUpdate_5.0.sql | 50 +++++++++++++++++++ 8 files changed, 126 insertions(+), 35 deletions(-) diff --git a/MP-Tablet/MP-Tablet.csproj b/MP-Tablet/MP-Tablet.csproj index f8b651f9..628cdca1 100644 --- a/MP-Tablet/MP-Tablet.csproj +++ b/MP-Tablet/MP-Tablet.csproj @@ -419,14 +419,6 @@ - - - - - - - - @@ -511,17 +503,7 @@ Designer - - - - - - - - - - Web.config diff --git a/MP-Tablet/WebUserControls/mod_ODL.ascx b/MP-Tablet/WebUserControls/mod_ODL.ascx index b09a02fd..a2617c4c 100644 --- a/MP-Tablet/WebUserControls/mod_ODL.ascx +++ b/MP-Tablet/WebUserControls/mod_ODL.ascx @@ -17,9 +17,22 @@
- - - +
+ +
+ + + + + + + + +
+ +
+
+
diff --git a/MP-Tablet/WebUserControls/mod_ODL.ascx.cs b/MP-Tablet/WebUserControls/mod_ODL.ascx.cs index 4a42793c..7c3e6762 100644 --- a/MP-Tablet/WebUserControls/mod_ODL.ascx.cs +++ b/MP-Tablet/WebUserControls/mod_ODL.ascx.cs @@ -37,6 +37,7 @@ namespace MoonProTablet.WebUserControls set { memLayer.ML.setSessionVal(string.Format("idxMacchina-{0}", uid), value); + hfIdxMacchina.Value = value; } } /// @@ -170,7 +171,7 @@ namespace MoonProTablet.WebUserControls { logger.lg.scriviLog(string.Format("Eccezione in recupero dati currHasOdl! {0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); } - bool hasNewOdl = DataLayer.obj.taSelOdlFree.getUnused().Rows.Count > 1; + bool hasNewOdl = DataLayer.obj.taSelOdlFree.getUnused(idxMacchina).Rows.Count > 1; // sistemo buttons! lbtStartAttr.Enabled = (isEnabled && (!inAttr && hasNewOdl)); lbtStartProd.Enabled = (isEnabled && inAttr); @@ -493,6 +494,11 @@ namespace MoonProTablet.WebUserControls /// /// protected void ddlODL_SelectedIndexChanged(object sender, EventArgs e) + { + checkDDL(); + } + + private void checkDDL() { if (ddlODL.SelectedIndex > 0) { @@ -505,6 +511,7 @@ namespace MoonProTablet.WebUserControls showNoteTC(false); } } + /// /// mostra/nasconde note /// @@ -562,6 +569,19 @@ namespace MoonProTablet.WebUserControls checkBtnStatus(); } - + protected void chkTutti_CheckedChanged(object sender, EventArgs e) + { + // SE selezionato tutti cambio valore idxMacchina... + if(chkTutti.Checked) + { + hfIdxMacchina.Value = "0"; + } + else + { + hfIdxMacchina.Value = idxMacchina; + } + ddlODL.DataBind(); + checkDDL(); + } } } \ No newline at end of file diff --git a/MP-Tablet/WebUserControls/mod_ODL.ascx.designer.cs b/MP-Tablet/WebUserControls/mod_ODL.ascx.designer.cs index 8107e58a..286a9187 100644 --- a/MP-Tablet/WebUserControls/mod_ODL.ascx.designer.cs +++ b/MP-Tablet/WebUserControls/mod_ODL.ascx.designer.cs @@ -39,6 +39,15 @@ namespace MoonProTablet.WebUserControls { /// protected global::System.Web.UI.WebControls.DropDownList ddlODL; + /// + /// Controllo hfIdxMacchina. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfIdxMacchina; + /// /// Controllo odsODL. /// @@ -48,6 +57,15 @@ namespace MoonProTablet.WebUserControls { /// protected global::System.Web.UI.WebControls.ObjectDataSource odsODL; + /// + /// Controllo chkTutti. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.CheckBox chkTutti; + /// /// Controllo divNote. /// diff --git a/MapoDb/DS_Utility.Designer.cs b/MapoDb/DS_Utility.Designer.cs index 896cb6ca..fc82d467 100644 --- a/MapoDb/DS_Utility.Designer.cs +++ b/MapoDb/DS_Utility.Designer.cs @@ -6582,13 +6582,14 @@ SELECT IdxMacchina, IdxStato, InizioStato, Value, CodArticolo, TempoCicloBase, P this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; - this._commandCollection[0].CommandText = "SELECT value, label, conditio FROM dbo.v_selODL"; + this._commandCollection[0].CommandText = "SELECT * FROM v_selODL"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[1].Connection = this.Connection; this._commandCollection[1].CommandText = "dbo.stp_vsODL_getUnused"; this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[1].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[1].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, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6619,8 +6620,14 @@ SELECT IdxMacchina, IdxStato, InizioStato, Value, CodArticolo, TempoCicloBase, P [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] - public virtual DS_Utility.v_selODLDataTable getUnused() { + public virtual DS_Utility.v_selODLDataTable getUnused(string IdxMacchina) { this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((IdxMacchina == null)) { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = ((string)(IdxMacchina)); + } DS_Utility.v_selODLDataTable dataTable = new DS_Utility.v_selODLDataTable(); this.Adapter.Fill(dataTable); return dataTable; diff --git a/MapoDb/DS_Utility.xsd b/MapoDb/DS_Utility.xsd index 64a5e494..1f106042 100644 --- a/MapoDb/DS_Utility.xsd +++ b/MapoDb/DS_Utility.xsd @@ -165,10 +165,10 @@ ORDER BY label - + - - SELECT value, label, conditio FROM dbo.v_selODL + + SELECT * FROM v_selODL @@ -186,6 +186,7 @@ ORDER BY label dbo.stp_vsODL_getUnused + diff --git a/MapoDb/DS_Utility.xss b/MapoDb/DS_Utility.xss index ab9924c5..3152c789 100644 --- a/MapoDb/DS_Utility.xss +++ b/MapoDb/DS_Utility.xss @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/SQL Utils/SqlUpdate_5.0.sql b/SQL Utils/SqlUpdate_5.0.sql index d6b17c76..be17af63 100644 --- a/SQL Utils/SqlUpdate_5.0.sql +++ b/SQL Utils/SqlUpdate_5.0.sql @@ -126,3 +126,53 @@ BEGIN END GO + + + +/****** Object: StoredProcedure [dbo].[stp_vsODL_getUnused] Script Date: 15/03/2018 17:07:08 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + + +/************************************* +* STORED PROCEDURE stp_vsODL_getUnused +* ottiene elenco ODL non ancora impiegati per macchina (se IdxMacchina <> 0) + +** modif.: S.E.L. - 2018.03.15 +**************************************/ +ALTER PROCEDURE [dbo].[stp_vsODL_getUnused] +( + @IdxMacchina NVARCHAR(50) = '0' +) +AS + +WITH cteODL AS ( + SELECT dbo.ODL.IdxODL AS value + ,CASE WHEN @IdxMacchina <> '0' THEN '' ELSE m.Nome + ' | ' END + + 'ODL ' + CAST(dbo.ODL.IdxODL AS NVARCHAR(50)) + + ' - art.' + dbo.ODL.CodArticolo + ' ' + aa.DescArticolo + + ' | ' + CAST(dbo.ODL.NumPezzi AS NVARCHAR(10)) + + ' pz | TC: ' + CAST(CAST(dbo.f_TC_100_60(dbo.ODL.TCAssegnato) AS DECIMAL(9, 2)) AS NVARCHAR(10)) + + ' (min.sec) | ' + CAST(CAST(dbo.ODL.TCAssegnato AS DECIMAL(9, 3)) AS NVARCHAR(10)) + + ' (min.cent)' AS label + ,dbo.ODL.DataInizio AS conditio + ,ODL.IdxMacchina + FROM dbo.ODL + INNER JOIN dbo.Macchine m ON dbo.ODL.IdxMacchina = m.IdxMacchina + INNER JOIN dbo.AnagArticoli aa ON dbo.ODL.CodArticolo = aa.CodArticolo +) + +SELECT 0 as value, 'Selezionare ODL' as label, NULL as conditio + +UNION + +SELECT value, label, conditio +FROM cteODL +WHERE conditio IS NULL + AND IdxMacchina = CASE WHEN @IdxMacchina <> '0' THEN @IdxMacchina ELSE IdxMacchina END + +RETURN +GO \ No newline at end of file