205 lines
6.4 KiB
C#
205 lines
6.4 KiB
C#
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
|
|
}
|
|
}
|
|
} |