nuovo modulo gestione load scan (da testare)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_LoadScan.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_LoadScan" %>
|
||||
|
||||
<%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_SelPedana.ascx" TagPrefix="uc1" TagName="cmp_SelPedana" %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
|
||||
<asp:HiddenField runat="server" ID="hfLastBCode" />
|
||||
<asp:HiddenField runat="server" ID="hfLastValidBCode" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<uc1:cmp_SelPedana runat="server" ID="cmp_SelPedana" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,210 @@
|
||||
using MagData;
|
||||
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_LoadScan : BaseUserControl
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Comando ULTIMO 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 è non nullo/vuoto
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
hfLastValidBCode.Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pedana selezionata
|
||||
/// </summary>
|
||||
protected string SelPedana
|
||||
{
|
||||
get
|
||||
{
|
||||
return cmp_SelPedana.Pedana;
|
||||
}
|
||||
set
|
||||
{
|
||||
cmp_SelPedana.Pedana = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
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 void Cmp_barcode_eh_doReset(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void doUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
private bool processLastCmd(bool doRaiseEv)
|
||||
{
|
||||
if (string.IsNullOrEmpty(lastCmd)) doRaiseEv = true;
|
||||
// processiamo barcode letto
|
||||
decodedData decoData = MagDataLayer.man.decodeBcode(lastValidCmd);
|
||||
switch (decoData.codeType)
|
||||
{
|
||||
case codeType.Command:
|
||||
case codeType.Pedana:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
processSuggestion(decoData.codeType, decoData.rawData, decoData.code, decoData.codeInt);
|
||||
doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.PackList:
|
||||
case codeType.Udc:
|
||||
default:
|
||||
cmp_barcode.showOutput("badge badge-danger", $"Codice sconosciuto: {decoData.rawData} --> ignoro");
|
||||
resetSelection(false);
|
||||
doRaiseEv = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return doRaiseEv;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processo il codice letto
|
||||
/// </summary>
|
||||
/// <param name="tipoCod"></param>
|
||||
/// <param name="rawData"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="codeInt"></param>
|
||||
private void processSuggestion(codeType tipoCod, string rawData, string code, int codeInt)
|
||||
{
|
||||
bool allOk = false;
|
||||
// processo suggerimenti
|
||||
switch (tipoCod)
|
||||
{
|
||||
case codeType.Command:
|
||||
|
||||
// verifico tipo comando
|
||||
switch (rawData)
|
||||
{
|
||||
case "CMDRESET":
|
||||
SelPedana = "ND";
|
||||
resetSelection(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case codeType.Pedana:
|
||||
// verifico AL esista
|
||||
var tabAL = MagDataLayer.man.taEAL.getByKey(rawData);
|
||||
if (tabAL.Rows.Count == 0)
|
||||
{
|
||||
cmp_barcode.showOutput("badge badge-warning", $"Errore: Pedana non trovata: {rawData}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tabAL[0].Status == 0)
|
||||
{
|
||||
cmp_barcode.showOutput("badge badge-danger", $"Errore: AL {rawData} NON completata");
|
||||
}
|
||||
else if (tabAL[0].Status == 2)
|
||||
{
|
||||
cmp_barcode.showOutput("badge badge-danger", $"Errore: AL {rawData} già caricato");
|
||||
}
|
||||
else if (tabAL[0].Status == 1)
|
||||
{
|
||||
if (rawData == SelPedana)
|
||||
{
|
||||
// se non associata associo...
|
||||
MagDataLayer.man.taEAL.updateStatus(rawData, 2);
|
||||
cmp_barcode.showOutput("badge badge-success", $"Pedana {rawData} caricata su vettore");
|
||||
SelPedana = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp_barcode.showOutput("badge badge-info", $"Pedana {rawData} valida, rileggere per confermare");
|
||||
SelPedana = rawData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
SelPedana = "";
|
||||
}
|
||||
// eventi barcode
|
||||
cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh;
|
||||
// eventi reset lotti IN
|
||||
cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload
|
||||
/// </summary>
|
||||
/// <param name="resetStatus"></param>
|
||||
protected void resetSelection(bool resetStatus)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MP_MAG.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_LoadScan
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// cmp_barcode control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::MP_MAG.WebUserControls.cmp_barcode cmp_barcode;
|
||||
|
||||
/// <summary>
|
||||
/// hfLastBCode control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastBCode;
|
||||
|
||||
/// <summary>
|
||||
/// hfLastValidBCode control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastValidBCode;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_SelPedana control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::MP_MAG.WebUserControls.cmp_SelPedana cmp_SelPedana;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user