diff --git a/MP-TAB/WebUserControls/BaseUserControl.cs b/MP-TAB/WebUserControls/BaseUserControl.cs index aeb722da..9b4595a2 100644 --- a/MP-TAB/WebUserControls/BaseUserControl.cs +++ b/MP-TAB/WebUserControls/BaseUserControl.cs @@ -49,6 +49,11 @@ namespace MoonProTablet.WebUserControls /// public bool enableGraphJS = memLayer.ML.cdvb("enableGraphJS"); + /// + /// Abilitazione gestione LOTTI in DB MAG + /// + public bool enableMagLotti = memLayer.ML.cdvb("enableMagLotti"); + /// /// Abilitazione gestione Pezzi LAsciati in macchina /// diff --git a/MP-TAB/WebUserControls/mod_ODL.ascx.cs b/MP-TAB/WebUserControls/mod_ODL.ascx.cs index 7ec41887..d91eac61 100644 --- a/MP-TAB/WebUserControls/mod_ODL.ascx.cs +++ b/MP-TAB/WebUserControls/mod_ODL.ascx.cs @@ -1209,8 +1209,10 @@ namespace MoonProTablet.WebUserControls DataLayerObj.taODL.fixMachineSlave(idxMacchina, 30, 1); } // se c'è gestione SchedaTecnica --> chiamo procedura update x lotti - - // FixMe-ToDo + if (enableSchedaTecnica) + { + DataLayerObj.taMagELotti.UpsertByOdl(idxODL, true); + } // riporto stringa lblOut.Text = sb.ToString().Replace("---", "
"); diff --git a/MP-TAB/WebUserControls/mod_dettaglioProd.ascx.cs b/MP-TAB/WebUserControls/mod_dettaglioProd.ascx.cs index 01a38373..228b9ec8 100644 --- a/MP-TAB/WebUserControls/mod_dettaglioProd.ascx.cs +++ b/MP-TAB/WebUserControls/mod_dettaglioProd.ascx.cs @@ -8,6 +8,20 @@ namespace MoonProTablet.WebUserControls { #region Private Methods + private void checkLottiOdl() + { + // controlla se abilitato check LOTTI MAG + if (enableMagLotti) + { + // controlla se ci sia lotto x ODL + if (DataLayerObj.taMagELotti.getByODL(idxOdl).Rows.Count == 0) + { + // se non c'è chiama stored x rigenerare + DataLayerObj.taMagELotti.UpsertByOdl(idxOdl, true); + } + } + } + /// /// popola le labels /// @@ -120,6 +134,13 @@ namespace MoonProTablet.WebUserControls /// protected void Page_Load(object sender, EventArgs e) { + if (!Page.IsPostBack) + { + if (enableSchedaTecnica) + { + checkLottiOdl(); + } + } try { popolaLabels(); diff --git a/MapoDb/DS_MAG.Designer.cs b/MapoDb/DS_MAG.Designer.cs index b37ba1f5..f4913c0a 100644 --- a/MapoDb/DS_MAG.Designer.cs +++ b/MapoDb/DS_MAG.Designer.cs @@ -307,6 +307,12 @@ namespace MapoDb { private global::System.Data.DataColumn columnAttivo; + private global::System.Data.DataColumn columnDescrArt; + + private global::System.Data.DataColumn columnCodArtExt; + + private global::System.Data.DataColumn columnDescStato; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] public ElencoLottiDataTable() { @@ -452,6 +458,30 @@ namespace MapoDb { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public global::System.Data.DataColumn DescrArtColumn { + get { + return this.columnDescrArt; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public global::System.Data.DataColumn CodArtExtColumn { + get { + return this.columnCodArtExt; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public global::System.Data.DataColumn DescStatoColumn { + get { + return this.columnDescStato; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Browsable(false)] @@ -489,7 +519,24 @@ namespace MapoDb { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] - public ElencoLottiRow AddElencoLottiRow(string Lotto, int IdxODL, string RifExt, string TipoLotto, string CodArt, string CodStato, string Origine, System.DateTime DtCrea, string Note, decimal QtaOrig, int NumUdc, decimal QtaCurr, System.DateTime DtMod, bool Attivo) { + public ElencoLottiRow AddElencoLottiRow( + string Lotto, + int IdxODL, + string RifExt, + string TipoLotto, + string CodArt, + string CodStato, + string Origine, + System.DateTime DtCrea, + string Note, + decimal QtaOrig, + int NumUdc, + decimal QtaCurr, + System.DateTime DtMod, + bool Attivo, + string DescrArt, + string CodArtExt, + string DescStato) { ElencoLottiRow rowElencoLottiRow = ((ElencoLottiRow)(this.NewRow())); object[] columnValuesArray = new object[] { Lotto, @@ -505,7 +552,10 @@ namespace MapoDb { NumUdc, QtaCurr, DtMod, - Attivo}; + Attivo, + DescrArt, + CodArtExt, + DescStato}; rowElencoLottiRow.ItemArray = columnValuesArray; this.Rows.Add(rowElencoLottiRow); return rowElencoLottiRow; @@ -549,6 +599,9 @@ namespace MapoDb { this.columnQtaCurr = base.Columns["QtaCurr"]; this.columnDtMod = base.Columns["DtMod"]; this.columnAttivo = base.Columns["Attivo"]; + this.columnDescrArt = base.Columns["DescrArt"]; + this.columnCodArtExt = base.Columns["CodArtExt"]; + this.columnDescStato = base.Columns["DescStato"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -582,6 +635,12 @@ namespace MapoDb { base.Columns.Add(this.columnDtMod); this.columnAttivo = new global::System.Data.DataColumn("Attivo", typeof(bool), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnAttivo); + this.columnDescrArt = new global::System.Data.DataColumn("DescrArt", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnDescrArt); + this.columnCodArtExt = new global::System.Data.DataColumn("CodArtExt", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnCodArtExt); + this.columnDescStato = new global::System.Data.DataColumn("DescStato", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnDescStato); this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { this.columnLotto}, true)); this.columnLotto.AllowDBNull = false; @@ -606,6 +665,11 @@ namespace MapoDb { this.columnQtaCurr.AllowDBNull = false; this.columnDtMod.AllowDBNull = false; this.columnAttivo.AllowDBNull = false; + this.columnDescrArt.AllowDBNull = false; + this.columnDescrArt.MaxLength = 250; + this.columnCodArtExt.AllowDBNull = false; + this.columnCodArtExt.MaxLength = 50; + this.columnDescStato.MaxLength = 50; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -899,6 +963,56 @@ namespace MapoDb { this[this.tableElencoLotti.AttivoColumn] = value; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public string DescrArt { + get { + return ((string)(this[this.tableElencoLotti.DescrArtColumn])); + } + set { + this[this.tableElencoLotti.DescrArtColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public string CodArtExt { + get { + return ((string)(this[this.tableElencoLotti.CodArtExtColumn])); + } + set { + this[this.tableElencoLotti.CodArtExtColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public string DescStato { + get { + try { + return ((string)(this[this.tableElencoLotti.DescStatoColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("Il valore della colonna \'DescStato\' nella tabella \'ElencoLotti\' è DBNull.", e); + } + } + set { + this[this.tableElencoLotti.DescStatoColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public bool IsDescStatoNull() { + return this.IsNull(this.tableElencoLotti.DescStatoColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + public void SetDescStatoNull() { + this[this.tableElencoLotti.DescStatoColumn] = global::System.Convert.DBNull; + } } /// @@ -1074,6 +1188,9 @@ namespace MapoDb.DS_MAGTableAdapters { tableMapping.ColumnMappings.Add("QtaCurr", "QtaCurr"); tableMapping.ColumnMappings.Add("DtMod", "DtMod"); tableMapping.ColumnMappings.Add("Attivo", "Attivo"); + tableMapping.ColumnMappings.Add("DescrArt", "DescrArt"); + tableMapping.ColumnMappings.Add("CodArtExt", "CodArtExt"); + tableMapping.ColumnMappings.Add("DescStato", "DescStato"); this._adapter.TableMappings.Add(tableMapping); this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection; @@ -1157,19 +1274,26 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note [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[2]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; - this._commandCollection[0].CommandText = "SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note," + - " QtaOrig, NumUdc, QtaCurr, DtMod, Attivo FROM dbo.ElencoLotti"; + this._commandCollection[0].CommandText = "SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea" + + ", Note, QtaOrig, NumUdc, QtaCurr, DtMod, Attivo, DescrArt, CodArtExt, DescStato\r" + + "\nFROM v_ElencoLotti"; 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_EL_UpsertByOdl"; + this._commandCollection[1].CommandText = "dbo.stp_EL_getByODL"; 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("@IdxODL", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@flgStorico", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[2].Connection = this.Connection; + this._commandCollection[2].CommandText = "dbo.stp_EL_UpsertByOdl"; + this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[2].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[2].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[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@flgStorico", 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()] @@ -1196,6 +1320,23 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note return dataTable; } + [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")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] + public virtual DS_MAG.ElencoLottiDataTable getByODL(global::System.Nullable IdxODL) { + this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((IdxODL.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[1].Value = ((int)(IdxODL.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + DS_MAG.ElencoLottiDataTable dataTable = new DS_MAG.ElencoLottiDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + [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")] @@ -1551,7 +1692,7 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int UpsertByOdl(global::System.Nullable IdxODL, global::System.Nullable flgStorico) { - global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1]; + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2]; if ((IdxODL.HasValue == true)) { command.Parameters[1].Value = ((int)(IdxODL.Value)); } diff --git a/MapoDb/DS_MAG.xsd b/MapoDb/DS_MAG.xsd index d1553c09..daf057da 100644 --- a/MapoDb/DS_MAG.xsd +++ b/MapoDb/DS_MAG.xsd @@ -9,7 +9,7 @@ - + DELETE FROM [dbo].[ElencoLotti] WHERE (([Lotto] = @Original_Lotto) AND ([IdxODL] = @Original_IdxODL) AND ([RifExt] = @Original_RifExt) AND ([TipoLotto] = @Original_TipoLotto) AND ([CodArt] = @Original_CodArt) AND ([CodStato] = @Original_CodStato) AND ([Origine] = @Original_Origine) AND ([DtCrea] = @Original_DtCrea) AND ([Note] = @Original_Note) AND ([QtaOrig] = @Original_QtaOrig) AND ([NumUdc] = @Original_NumUdc) AND ([QtaCurr] = @Original_QtaCurr) AND ([DtMod] = @Original_DtMod) AND ([Attivo] = @Original_Attivo)) @@ -55,7 +55,8 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note - SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note, QtaOrig, NumUdc, QtaCurr, DtMod, Attivo FROM dbo.ElencoLotti + SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note, QtaOrig, NumUdc, QtaCurr, DtMod, Attivo, DescrArt, CodArtExt, DescStato +FROM v_ElencoLotti @@ -112,8 +113,22 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note + + + + + + + dbo.stp_EL_getByODL + + + + + + + @@ -195,6 +210,27 @@ SELECT Lotto, IdxODL, RifExt, TipoLotto, CodArt, CodStato, Origine, DtCrea, Note + + + + + + + + + + + + + + + + + + + + + diff --git a/MapoDb/DS_MAG.xss b/MapoDb/DS_MAG.xss index 5f282702..cf581665 100644 --- a/MapoDb/DS_MAG.xss +++ b/MapoDb/DS_MAG.xss @@ -1 +1,12 @@ - \ No newline at end of file + + + + + + + + \ No newline at end of file