diff --git a/MP-MAG/WebUserControls/cmp_barcode.ascx b/MP-MAG/WebUserControls/cmp_barcode.ascx new file mode 100644 index 0000000..57c77d9 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_barcode.ascx @@ -0,0 +1,7 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_barcode.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_barcode" %> + +

BARCODE

+
+ + +
diff --git a/MP-MAG/WebUserControls/cmp_barcode.ascx.cs b/MP-MAG/WebUserControls/cmp_barcode.ascx.cs new file mode 100644 index 0000000..b0e6f93 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_barcode.ascx.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace MP_MAG.WebUserControls +{ + public partial class cmp_barcode : BaseUserControl + { + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetMessage(); + } + else if (inputAcquired == "") + { + raiseEvent(); + } + } + + public void resetMessage() + { + lblOutput.Visible = false; + lblOutput.Text = ""; + } + + protected void txtBarcode_TextChanged(object sender, EventArgs e) + { + raiseEvent(); + } + /// + /// Valore acquisito in lettura barcode + /// + public string inputAcquired + { + get + { + return txtBarcode.Text.Trim(); + } + set + { + txtBarcode.Text = ""; + } + } + /// + /// Gestione output da mostrare (opzionale + /// + /// + /// + public void showOutput(string cssClass, string messaggio) + { + // In primis: mostro qualcosa SOLO SE ho del testo + lblOutput.Visible = (messaggio != ""); + lblOutput.Text = messaggio; + lblOutput.Attributes.Remove("class"); + lblOutput.Attributes.Add("class", cssClass); + } + } +} \ No newline at end of file diff --git a/MP-MAG/WebUserControls/cmp_barcode.ascx.designer.cs b/MP-MAG/WebUserControls/cmp_barcode.ascx.designer.cs new file mode 100644 index 0000000..db14714 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_barcode.ascx.designer.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace MP_MAG.WebUserControls +{ + + + public partial class cmp_barcode + { + + /// + /// Controllo txtBarcode. + /// + /// + /// 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.TextBox txtBarcode; + + /// + /// Controllo lblOutput. + /// + /// + /// 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.Label lblOutput; + } +} diff --git a/MP-MAG/WebUserControls/cmp_dettLotti.ascx b/MP-MAG/WebUserControls/cmp_dettLotti.ascx index 7ccf5bc..9e6b856 100644 --- a/MP-MAG/WebUserControls/cmp_dettLotti.ascx +++ b/MP-MAG/WebUserControls/cmp_dettLotti.ascx @@ -23,14 +23,14 @@ Nessun Risultato - + <%-- - + --%> diff --git a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx new file mode 100644 index 0000000..52b0dfa --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx @@ -0,0 +1,10 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_prtSemilav.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_prtSemilav" %> +<%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %> + + + + + + + + diff --git a/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs new file mode 100644 index 0000000..2e4ad80 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace MP_MAG.WebUserControls +{ + public partial class cmp_prtSemilav : BaseUserControl + { + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfLastBCode.Value; + } + set + { + hfLastBCode.Value = value; + lastValidCmd = value; + } + } + /// + /// ULTIMO Comando barcode VALIDO (!="") letto + /// + protected string lastValidCmd + { + get + { + return hfLastValidBCode.Value; + } + set + { + // solo se è !="" + if (value != "") + { + hfLastValidBCode.Value = value; + } + } + } + protected void Page_Load(object sender, EventArgs e) + { + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; + } + + private void Cmp_barcode_eh_doReset(object sender, EventArgs e) + { + resetIcons(); + } + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + // verifico barcode + lblDecodedData.Text = cmp_barcode.inputAcquired; + + + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + + // reset comando + cmp_barcode.inputAcquired = ""; + // aggiorno... + doUpdate(); + + } + + private void resetIcons() + { +#if false + lblDestination.CssClass = "text-secondary"; + lblMessage.Text = ""; + lblDestination.Text = ""; + lblLastBCode.Text = ""; + lbtCancel.Visible = false; + lbtScrapped.Visible = false; + lbtParkArea.Visible = false; + lbtResetSel.Visible = (itemIdSelected != 0); +#endif + } + private bool processLastCmd(bool doRaiseEv) + { + if (lastCmd == "") doRaiseEv = true; +#if false + // processiamo barcode letto + decodedData decoData = DataLayer.man.decodeBcode(lastCmd); + switch (decoData.codeType) + { + case codeType.UNK: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + doRaiseEv = true; + break; + case codeType.Item: + cmp_barcode.showOutput("badge badge-success", $"Valid IT Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.ItemGeneric: + cmp_barcode.showOutput("badge badge-success", $"Valid IG Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.OtherItem: + cmp_barcode.showOutput("badge badge-success", $"Valid Generic PART Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.Material: + cmp_barcode.showOutput("badge badge-warning", $"Material - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Sheet: + cmp_barcode.showOutput("badge badge-warning", $"Sheet - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Stack: + cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Cart: + cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); + processItemSuggestion(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); + break; + default: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + break; + } +#endif + + return doRaiseEv; + } + + private void doUpdate() + { +#if false + // reset grafico + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + + // in base al secondo mostro uno o altro... + if (showCart) + { + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success"); + lblMessage.Text = "Item recognized"; + // controllo SE HO cart + if (currCartTab.Count == 1) + { + var cartRow = currCartTab[0]; + // imposto OUT + lblDestination.Text = $"SEND TO CART C{cartRow.CartIndex} ({cartRow.CartDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!"; + } + lblDestination.CssClass = "text-success"; + } + else if (showBin) + { + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary"); + lblMessage.Text = "Item recognized"; + if (currBinTab.Count == 1) + { + var binRow = currBinTab[0]; + lblDestination.Text = $"SEND TO BIN B{binRow.BinIndex} ({binRow.BinDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!"; + } + lblDestination.CssClass = "text-primary"; + } + if (showSecOp) + { + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info"); + lblMessage.Text = "Item recognized"; + lblLastBCode.Text = $"DO SEC OP: {secOp}"; + lblLastBCode.CssClass = "text-info"; + } + // fix btn reset! + lbtResetSel.Visible = (itemIdSelected != 0); +#endif + } + } +} \ 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 new file mode 100644 index 0000000..7b0bd48 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_prtSemilav.ascx.designer.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace MP_MAG.WebUserControls +{ + + + public partial class cmp_prtSemilav + { + + /// + /// Controllo hfLastBCode. + /// + /// + /// 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 hfLastBCode; + + /// + /// Controllo hfLastValidBCode. + /// + /// + /// 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 hfLastValidBCode; + + /// + /// Controllo cmp_barcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::MP_MAG.WebUserControls.cmp_barcode cmp_barcode; + + /// + /// Controllo lblDecodedData. + /// + /// + /// 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.Label lblDecodedData; + } +}