174 lines
5.5 KiB
C#
174 lines
5.5 KiB
C#
using Microsoft.Ajax.Utilities;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace MoonProTablet.WebUserControls
|
|
{
|
|
public partial class cmp_ST_objCheck : BaseUserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Valore BCode acquisito
|
|
/// </summary>
|
|
public string BCodeVal
|
|
{
|
|
get
|
|
{
|
|
return txtInput.Text.Trim().ToUpper();
|
|
}
|
|
set
|
|
{
|
|
txtInput.Text = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cod Articolo selezionato
|
|
/// </summary>
|
|
public string CodArticolo
|
|
{
|
|
get
|
|
{
|
|
return hfCodArticolo.Value.Trim();
|
|
}
|
|
set
|
|
{
|
|
hfCodArticolo.Value = value.Trim();
|
|
checkInputData();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// oggetto comando locale alla classe formato RAW
|
|
/// </summary>
|
|
public string rawInput
|
|
{
|
|
get
|
|
{
|
|
string answ;
|
|
if (memLayer.ML.isInSessionObject("barcodeRaw"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("barcodeRaw");
|
|
}
|
|
else
|
|
{
|
|
answ = "";
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("barcodeRaw", value, false);
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void checkInputData()
|
|
{
|
|
bool showInput = false;
|
|
try
|
|
{
|
|
showInput = DataLayerObj.taSTAR.getPendingByOdl(idxOdl).Count > 0;
|
|
}
|
|
catch
|
|
{ }
|
|
divCheckData.Visible = showInput;
|
|
}
|
|
|
|
/// <summary>
|
|
/// procedura pricipale decodifica Barcode
|
|
/// </summary>
|
|
private void processInput()
|
|
{
|
|
bool found = false;
|
|
// per prima cosa recupero i valori "Pending" da leggere come candidati...
|
|
var tabRichieste = DataLayerObj.taSTAR.getPendingByOdl(idxOdl);
|
|
if (tabRichieste != null && tabRichieste.Count > 0)
|
|
{
|
|
// cerco per EQ come primo step...
|
|
var trovatoEq = tabRichieste.Where(x => x.CheckType == "EQ" && x.Value == BCodeVal);
|
|
if (trovatoEq != null && trovatoEq.Count() > 0)
|
|
{
|
|
// recupero record..
|
|
var datiEqCheck = trovatoEq.FirstOrDefault();
|
|
// registro trovato
|
|
found = true;
|
|
lblMessage.Text = $"Parametro acquisito: {BCodeVal}";
|
|
lblMessage.CssClass = "text-success";
|
|
// upsert controllo
|
|
DataLayerObj.taSTChk.upsertQuery(idxOdl, datiEqCheck.IdxST, datiEqCheck.Oggetto, datiEqCheck.Num, BCodeVal, BCodeVal, true, user_std.UtSn.utente);
|
|
}
|
|
|
|
// se non trovato
|
|
if (!found)
|
|
{
|
|
// controllo condizione tipo BATCH (speciale) - prima solo che CI SIA una richiesta di questo tipo
|
|
var trovatoBatch = tabRichieste.Where(x => x.CheckType == "BATCH");
|
|
if (trovatoBatch != null && trovatoBatch.Count() > 0)
|
|
{
|
|
// recupero record.. cercando in giacenza il LOTTO...
|
|
var tabGiacenzeLotto = DataLayerObj.taArcaGiac.getBySearch(null, "", BCodeVal, "", false);
|
|
if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0)
|
|
{
|
|
var datiBatchCheck = trovatoBatch.FirstOrDefault();
|
|
var datiLotto = tabGiacenzeLotto.FirstOrDefault();
|
|
|
|
// registro trovato
|
|
found = true;
|
|
lblMessage.Text = $"Parametro acquisito: {BCodeVal} --> {datiLotto.Cd_AR}";
|
|
lblMessage.CssClass = "text-success";
|
|
// upsert controllo
|
|
DataLayerObj.taSTChk.upsertQuery(idxOdl, datiBatchCheck.IdxST, datiBatchCheck.Oggetto, datiBatchCheck.Num, BCodeVal, datiLotto.Cd_AR, true, user_std.UtSn.utente);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lblMessage.Text = "Parametro non valido";
|
|
lblMessage.CssClass = "text-secondary";
|
|
}
|
|
|
|
// sistemo visualizzaizone componente
|
|
BCodeVal = "";
|
|
checkInputData();
|
|
// sollevo evento
|
|
reportUpdate();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
lblMessage.Text = "prego confermare parametri";
|
|
lblMessage.CssClass = "text-dark";
|
|
}
|
|
txtInput.Focus();
|
|
}
|
|
|
|
/// <summary>
|
|
/// barcode completato con invio...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtInput_TextChanged(object sender, EventArgs e)
|
|
{
|
|
processInput();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |