diff --git a/NKC_WF/WebUserControls/cmp_searchItems.ascx b/NKC_WF/WebUserControls/cmp_searchItems.ascx index 2fcb643..b285ec1 100644 --- a/NKC_WF/WebUserControls/cmp_searchItems.ascx +++ b/NKC_WF/WebUserControls/cmp_searchItems.ascx @@ -1 +1,12 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_searchItems.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_searchItems" %> + +
+
+
+ +
+
+ +
+
+
diff --git a/NKC_WF/WebUserControls/cmp_searchItems.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_searchItems.ascx.designer.cs index 0b09990..ffa2b65 100644 --- a/NKC_WF/WebUserControls/cmp_searchItems.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_searchItems.ascx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// +// // Codice generato da uno strumento. // // Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// il codice viene rigenerato. +// //------------------------------------------------------------------------------ namespace NKC_WF.WebUserControls @@ -13,5 +13,23 @@ namespace NKC_WF.WebUserControls public partial class cmp_searchItems { + + /// + /// Controllo lblSearch. + /// + /// + /// 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 lblSearch; + + /// + /// Controllo lblDescr. + /// + /// + /// 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 lblDescr; } } diff --git a/NKC_WF/site/GlobalSearch.aspx b/NKC_WF/site/GlobalSearch.aspx index 45edfdf..0e707ad 100644 --- a/NKC_WF/site/GlobalSearch.aspx +++ b/NKC_WF/site/GlobalSearch.aspx @@ -6,6 +6,9 @@ +
Advanced SEARCH
- + + +
diff --git a/NKC_WF/site/GlobalSearch.aspx.cs b/NKC_WF/site/GlobalSearch.aspx.cs index a047102..bc4c270 100644 --- a/NKC_WF/site/GlobalSearch.aspx.cs +++ b/NKC_WF/site/GlobalSearch.aspx.cs @@ -1,4 +1,6 @@ -using System; +using AppData; +using NKC_SDK; +using System; using System.Collections.Generic; using System.Linq; using System.Web; @@ -7,14 +9,298 @@ using System.Web.UI.WebControls; namespace NKC_WF.site { - public partial class GlobalSearch : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class GlobalSearch : System.Web.UI.Page { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - } + /// + /// 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) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + cmp_searchItems.Visible = false; + } + 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) + { + cmp_searchItems.Visible = false; + } + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + + // reset comando + cmp_barcode.inputAcquired = ""; + // aggiorno... + doUpdate(); + } + + private bool processLastCmd(bool doRaiseEv) + { + if (lastCmd == "") doRaiseEv = true; + // processiamo barcode letto + decodedData decoData = DataLayer.man.decodeBcode(lastCmd); +#if false + 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; + } + + + /// + /// Processo il DataMatrix letto + /// + /// + /// + /// + private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) + { + DS_App.ItemListDataTable tabItem = null; +#if false + // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) + switch (tipoCod) + { + case codeType.OtherItem: + var tabOtherItem = DataLayer.man.taOtItem.getByKey(codeInt); + if (tabOtherItem.Count == 1) + { + showOtherItemDetail(true, tabOtherItem[0], false); + } + break; + case codeType.Item: + tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.ItemGeneric: + // PRIMA CERCSE ne ho in stato 1..3 + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); + if (tabItem.Count == 0) + { + // se NON ne trovo cerci FINO a stato 5... + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 5); + } + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.Cart: + // verifico NON SIA richiesto PAINT + if (showBin) + { + displError("PAINT: BIN REQUESTED: please retry", true); + } + else + { + if (currCartTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currCartTab[0].CartDtmx) + { + displError("INCORRECT CART: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; + resetSelection(false); + } + } + } + break; + case codeType.Bin: + // verifico NON SIA richiesto PAINT + if (showCart) + { + displError("NOT PAINTED: CART REQUESTED: please retry", true); + } + else + { + if (currBinTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currBinTab[0].BinDtmx) + { + displError("INCORRECT BIN: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; + resetSelection(false); + } + } + } + break; + default: + break; + } + + +#endif + + + } + + + private void doUpdate() + { + cmp_searchItems.Visible = true; +#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/NKC_WF/site/GlobalSearch.aspx.designer.cs b/NKC_WF/site/GlobalSearch.aspx.designer.cs index 8615914..22eed16 100644 --- a/NKC_WF/site/GlobalSearch.aspx.designer.cs +++ b/NKC_WF/site/GlobalSearch.aspx.designer.cs @@ -23,6 +23,24 @@ namespace NKC_WF.site /// protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode; + /// + /// 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_searchItems. ///