diff --git a/MP-MAG/SMART/prtSemilav.aspx b/MP-MAG/SMART/prtSemilav.aspx index 7d2cf6d..33506cf 100644 --- a/MP-MAG/SMART/prtSemilav.aspx +++ b/MP-MAG/SMART/prtSemilav.aspx @@ -6,22 +6,5 @@ -
-
- Elenco Lotti IN -
-
- -
-
- Lotto OUT -
- elenco UDC stampati? numero? -
-
- note? -
- btn stampa -
-
+
diff --git a/MP-MAG/Web.config b/MP-MAG/Web.config index 47ba9a4..045dc7b 100644 --- a/MP-MAG/Web.config +++ b/MP-MAG/Web.config @@ -26,6 +26,7 @@ + diff --git a/MP-MAG/WebUserControls/cmp_dettLotti.ascx b/MP-MAG/WebUserControls/cmp_dettLotti.ascx index 9e6b856..ef346eb 100644 --- a/MP-MAG/WebUserControls/cmp_dettLotti.ascx +++ b/MP-MAG/WebUserControls/cmp_dettLotti.ascx @@ -53,7 +53,7 @@ - + diff --git a/MP-MAG/WebUserControls/cmp_elencoLotti.ascx b/MP-MAG/WebUserControls/cmp_elencoLotti.ascx index fbf1237..990451a 100644 --- a/MP-MAG/WebUserControls/cmp_elencoLotti.ascx +++ b/MP-MAG/WebUserControls/cmp_elencoLotti.ascx @@ -45,7 +45,7 @@ - + diff --git a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx index 52b0dfa..8107ae7 100644 --- a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx @@ -2,9 +2,117 @@ <%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %> +
+
+
+
+
+
+
Elenco Lotti IN
+
+
+ +
+
+
+
+ + + + + + + Nessun Risultato + + + <%-- + + + + + + + --%> + + + + + + + + +
+
+ +
+
+ +
+
+ + +
+
+
+
+ + + + + + + +
+ +
+
+ + +
+
+
+ + + + + / + + + + + + + + + +
+
+ + + + + + +
+
+ +
+
+ + + + +
+
+ Lotto OUT +
+ elenco UDC stampati? numero? +
+
+ note? +
+ btn stampa +
+
- - - - diff --git a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs index 69b3c7d..e8402ce 100644 --- a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs @@ -1,4 +1,5 @@ using MagData; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -43,8 +44,45 @@ namespace MP_MAG.WebUserControls } } } + /// + /// Elenco dei lotti selezionati + /// + protected List lottiSel + { + get + { + List answ = null; + string rawVal = hfJsonLotti.Value; + try + { + answ = JsonConvert.DeserializeObject>(rawVal); + } + catch + { } + if (answ == null) + { + answ = new List(); + } + return answ; + } + set + { + string rawVal = JsonConvert.SerializeObject(value); + hfJsonLotti.Value = rawVal; + // salvo ANCHE elenco in formato #lotto#lotto# + string eliString = $"#{string.Join("#", value)}#"; + hfHashList.Value = eliString; + // update grView... + grViewLottoIn.DataBind(); + } + } + protected void Page_Load(object sender, EventArgs e) { + if(!Page.IsPostBack) + { + lottiSel = new List(); + } cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; } @@ -93,13 +131,13 @@ namespace MP_MAG.WebUserControls switch (decoData.codeType) { case codeType.UNK: - cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + cmp_barcode.showOutput("text-danger", $"Codice sconosciuto: {decoData.rawData} --> ignoro"); resetSelection(false); doRaiseEv = true; break; case codeType.Lotto: cmp_barcode.showOutput("badge badge-success", $"{decoData.description}"); - //processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + processSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); break; case codeType.LottoInt: cmp_barcode.showOutput("badge badge-success", $"{decoData.description}"); @@ -107,11 +145,11 @@ namespace MP_MAG.WebUserControls break; case codeType.Date: cmp_barcode.showOutput("badge badge-success", $"{decoData.description}"); - //processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + //processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); break; case codeType.PartNumber: cmp_barcode.showOutput("badge badge-success", $"{decoData.description}"); - //processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + //processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); break; case codeType.Quantity: cmp_barcode.showOutput("badge badge-success", $"{decoData.description}"); @@ -127,38 +165,46 @@ namespace MP_MAG.WebUserControls // break; //case codeType.Cart: // cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); - // processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + // processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); // break; //case codeType.Bin: // cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); - // processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + // processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); // break; //default: // cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); // resetSelection(false); // break; - } + } return doRaiseEv; } /// - /// Processo il DataMatrix letto + /// Processo il codice letto /// /// /// /// - private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) + private void processSuggestion(codeType tipoCod, string rawData, int codeInt) { //DS_App.ItemListDataTable tabItem = null; // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) switch (tipoCod) { case codeType.Lotto: - //var tabOtherItem = DataLayer.man.taOtItem.getByKey(codeInt); - //if (tabOtherItem.Count == 1) - //{ - // showOtherItemDetail(true, tabOtherItem[0], false); - //} + // IN PRIMIS cerco lotto valido + DS_Mag.ElencoLottiDataTable tabLotti; + tabLotti = MagDataLayer.man.taEL.getByKey(rawData, "E"); + if (tabLotti.Count == 1) + { + // se trovato cerco in elenco --> aggiungo in lista se non c'è + var currLotti = lottiSel; + if (!currLotti.Contains(rawData)) + { + currLotti.Add(rawData); + lottiSel = currLotti; + } + } break; //case codeType.Item: // tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); @@ -393,5 +439,15 @@ namespace MP_MAG.WebUserControls lbtResetSel.Visible = (itemIdSelected != 0); #endif } + /// + /// reset sel lottoIn + /// + /// + /// + protected void lbtResetLottoIn_Click(object sender, EventArgs e) + { + // resetto + lottiSel = new List(); + } } } \ No newline at end of file diff --git a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.designer.cs b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.designer.cs index 7b0bd48..84059a7 100644 --- a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.designer.cs +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.designer.cs @@ -14,6 +14,51 @@ namespace MP_MAG.WebUserControls public partial class cmp_prtSemilav { + /// + /// Controllo lbtResetLottoIn. + /// + /// + /// 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.LinkButton lbtResetLottoIn; + + /// + /// Controllo grViewLottoIn. + /// + /// + /// 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.GridView grViewLottoIn; + + /// + /// Controllo odsLottiIn. + /// + /// + /// 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.ObjectDataSource odsLottiIn; + + /// + /// Controllo hfHashList. + /// + /// + /// 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 hfHashList; + + /// + /// Controllo hfJsonLotti. + /// + /// + /// 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 hfJsonLotti; + /// /// Controllo hfLastBCode. /// diff --git a/MagData/DS_Mag.Designer.cs b/MagData/DS_Mag.Designer.cs index 13d9431..5e03602 100644 --- a/MagData/DS_Mag.Designer.cs +++ b/MagData/DS_Mag.Designer.cs @@ -2470,7 +2470,7 @@ namespace MagData.DS_MagTableAdapters { [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 = "SELECT *\r\nFROM V_ElencoLotti\r\n"; @@ -2483,17 +2483,23 @@ namespace MagData.DS_MagTableAdapters { this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@LottoOut", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 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_getByKey"; + this._commandCollection[2].CommandText = "dbo.stp_EL_getByHashList"; 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("@Lotto", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TipoLotto", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@elLotti", global::System.Data.SqlDbType.NVarChar, 500, global::System.Data.ParameterDirection.Input, 0, 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_EL_getBySearch"; + this._commandCollection[3].CommandText = "dbo.stp_EL_getByKey"; 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("@SearchVal", 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("@Lotto", 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("@TipoLotto", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 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_EL_getBySearch"; + 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("@SearchVal", 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()] @@ -2541,8 +2547,25 @@ namespace MagData.DS_MagTableAdapters { [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 getByKey(string Lotto, string TipoLotto) { + public virtual DS_Mag.ElencoLottiDataTable getByHashList(string elLotti) { this.Adapter.SelectCommand = this.CommandCollection[2]; + if ((elLotti == null)) { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = ((string)(elLotti)); + } + 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")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] + public virtual DS_Mag.ElencoLottiDataTable getByKey(string Lotto, string TipoLotto) { + this.Adapter.SelectCommand = this.CommandCollection[3]; if ((Lotto == null)) { this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; } @@ -2565,7 +2588,7 @@ namespace MagData.DS_MagTableAdapters { [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] public virtual DS_Mag.ElencoLottiDataTable getBySearch(string SearchVal) { - this.Adapter.SelectCommand = this.CommandCollection[3]; + this.Adapter.SelectCommand = this.CommandCollection[4]; if ((SearchVal == null)) { this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; } diff --git a/MagData/DS_Mag.xsd b/MagData/DS_Mag.xsd index 27ad552..7411aee 100644 --- a/MagData/DS_Mag.xsd +++ b/MagData/DS_Mag.xsd @@ -49,6 +49,17 @@ FROM V_ElencoLotti + + + + dbo.stp_EL_getByHashList + + + + + + + diff --git a/MagData/MagDataLayer.cs b/MagData/MagDataLayer.cs index a7c8401..ae48b6d 100644 --- a/MagData/MagDataLayer.cs +++ b/MagData/MagDataLayer.cs @@ -5,12 +5,22 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Text.RegularExpressions; using System.Web; namespace MagData { public class MagDataLayer { + + #region definizione Regexp + /// + /// RegExp x Qty odette + /// + public static string re_QtyOdette = memLayer.ML.cdv("regExp_QtyOdette"); + + #endregion + #region oggetti public // reports @@ -247,12 +257,21 @@ namespace MagData } else if (bcValue.StartsWith("Q")) { - answ.codeType = codeType.Quantity; - answ.code = bcValue.Replace("Q", ""); - int codeInt = 0; - int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt); - answ.codeInt = codeInt; - answ.description = $"Qty Odette: {answ.code}"; + // controllo regex + Match testQty = Regex.Match(bcValue, re_QtyOdette); + if (testQty.Success) + { + answ.codeType = codeType.Quantity; + answ.code = bcValue.Replace("Q", ""); + int codeInt = 0; + int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt); + answ.codeInt = codeInt; + answ.description = $"Qty Odette: {answ.code}"; + } + else + { + answ.codeType = codeType.UNK; + } } else if (bcValue.StartsWith("H")) {