inizio ad aggiungere componenti barcode
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_barcode.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_barcode" %>
|
||||
|
||||
<h4>BARCODE</h4>
|
||||
<div class="form-group bigText">
|
||||
<asp:TextBox runat="server" ID="txtBarcode" class="form-control" autofocus="true" AutoPostBack="True" OnTextChanged="txtBarcode_TextChanged"></asp:TextBox>
|
||||
<asp:Label ID="lblOutput" runat="server" for="txtBarcode" Width="100%" />
|
||||
</div>
|
||||
@@ -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();
|
||||
}
|
||||
/// <summary>
|
||||
/// Valore acquisito in lettura barcode
|
||||
/// </summary>
|
||||
public string inputAcquired
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtBarcode.Text.Trim();
|
||||
}
|
||||
set
|
||||
{
|
||||
txtBarcode.Text = "";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gestione output da mostrare (opzionale
|
||||
/// </summary>
|
||||
/// <param name="cssClass"></param>
|
||||
/// <param name="messaggio"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MP_MAG.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_barcode
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo txtBarcode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtBarcode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblOutput.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblOutput;
|
||||
}
|
||||
}
|
||||
@@ -23,14 +23,14 @@
|
||||
Nessun Risultato
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<%--<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton ID="lbtReset" runat="server" OnClick="lbtReset_Click" CssClass="btn btn-sm btn-primary" Visible="true" ToolTip="Reset"><i class="fas fa-sync"></i></asp:LinkButton>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtSel" runat="server" CausesValidation="False" CommandName="Select" Text="Seleziona" CssClass="btn btn-sm btn-info"><i class="fas fa-search"></i></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>--%>
|
||||
<asp:BoundField DataField="Lotto" HeaderText="Lotto" ReadOnly="True" SortExpression="Lotto" />
|
||||
<asp:TemplateField HeaderText="Tipo" SortExpression="TipoLotto">
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -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" %>
|
||||
|
||||
|
||||
|
||||
<asp:HiddenField runat="server" ID="hfLastBCode" />
|
||||
<asp:HiddenField runat="server" ID="hfLastValidBCode" />
|
||||
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
|
||||
<asp:Label runat="server" ID="lblDecodedData" />
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Comando barcode letto
|
||||
/// </summary>
|
||||
protected string lastCmd
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfLastBCode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfLastBCode.Value = value;
|
||||
lastValidCmd = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// ULTIMO Comando barcode VALIDO (!="") letto
|
||||
/// </summary>
|
||||
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 <b>C{cartRow.CartIndex}</b> ({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>B{binRow.BinIndex}</b> ({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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MP_MAG.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_prtSemilav
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfLastBCode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastBCode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfLastValidBCode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastValidBCode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo cmp_barcode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::MP_MAG.WebUserControls.cmp_barcode cmp_barcode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblDecodedData.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblDecodedData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user