296c151fca
fix reset ricerca lav e sterratura IN/OUT x particolare
477 lines
17 KiB
C#
477 lines
17 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Net;
|
|
using SteamWare;
|
|
using GMW_data;
|
|
|
|
namespace GMW.WebUserControls
|
|
{
|
|
public partial class mod_lavMeccIN : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_nuovaRicerca;
|
|
public event EventHandler eh_reqUpdate;
|
|
/// <summary>
|
|
/// stringa UID univoca
|
|
/// </summary>
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "_").Replace("-", "_");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
fixRicercaUdc();
|
|
traduciObj();
|
|
idxCella = Postazione.currIdxCella;
|
|
}
|
|
doChecks();
|
|
}
|
|
/// <summary>
|
|
/// IDX cella associata alla linea corrente
|
|
/// </summary>
|
|
protected int idxCella
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (memLayer.ML.isInSessionObject("IdxCellaLineaLM_IN"))
|
|
{
|
|
answ = memLayer.ML.IntSessionObj("IdxCellaLineaLM_IN");
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxCellaLineaLM_IN", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// verifica se si debab mostrare un campo ricerca UDC attivo...
|
|
/// </summary>
|
|
private void fixRicercaUdc()
|
|
{
|
|
if (memLayer.ML.isInSessionObject("valoreCercatoLMI"))
|
|
{
|
|
testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoLMI");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// richiesta (ri)stampa UDC
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void ristampa()
|
|
{
|
|
MagClass.magazzino.stampaUdc(udcReq, Postazione.printer, tipoCartellino.cartFiniti, Request.UserHostName);
|
|
// registro ri-stampa UDC
|
|
DateTime adesso = DateTime.Now;
|
|
// calcolo particolare...
|
|
DS_magazzino.ElencoCartelliniRow rigaUDC;
|
|
string particolare = "";
|
|
try
|
|
{
|
|
rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
|
|
particolare = rigaUDC.Particolare;
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finito LM IN {0}", udcReq), tipoLog.EXCEPTION);
|
|
}
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finito LM IN");
|
|
}
|
|
/// <summary>
|
|
/// udc da stampare
|
|
/// </summary>
|
|
protected string udcReq
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("udcSelSAO");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua controlli visibilità
|
|
/// </summary>
|
|
private void doChecks()
|
|
{
|
|
checkBarcode();
|
|
}
|
|
/// <summary>
|
|
/// sistemo labels oggetti
|
|
/// </summary>
|
|
private void traduciObj()
|
|
{
|
|
btnCerca.Text = traduci("btnSearch");
|
|
}
|
|
/// <summary>
|
|
/// restituisce il nome della pagina corrente
|
|
/// </summary>
|
|
protected string PagCorrente
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
Uri MyUrl = Request.Url;
|
|
string delimStr = "/";
|
|
char[] delimiter = delimStr.ToCharArray();
|
|
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
|
|
int n = finalUrl.Length;
|
|
answ = finalUrl[n - 1].ToString();
|
|
DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
|
|
answ = riga.NOME;
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
/// <summary>
|
|
/// indica se i caratteri vadano forzati a maiuscoli
|
|
/// </summary>
|
|
public bool forceUppercase
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.confReadBool("forceUppercase");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// decodifica il tipo barcode acquisito
|
|
/// </summary>
|
|
public tipoCodiceBarcode tipoBCode
|
|
{
|
|
get
|
|
{
|
|
tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
|
|
int trovati = 0;
|
|
// controllo non si tratti di un comando...
|
|
string preCmd = memLayer.ML.confReadString("prefComandi");
|
|
if (barcodeIn.StartsWith(preCmd))
|
|
{
|
|
answ = tipoCodiceBarcode.Comando;
|
|
}
|
|
else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare) && TermClass.Ter.isAnima(barcodeIn)) // è un particolare... ed un anima...
|
|
{
|
|
answ = tipoCodiceBarcode.Particolare;
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
// cerco tra gitterbox (UDC)...
|
|
trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
|
|
if (trovati > 0)
|
|
{
|
|
answ = tipoCodiceBarcode.UDC;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// valore barcode
|
|
/// </summary>
|
|
public string barcodeIn
|
|
{
|
|
get
|
|
{
|
|
return txtBarcode.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtBarcode.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// controlla se ci sia un barcode
|
|
/// </summary>
|
|
private void checkBarcode()
|
|
{
|
|
if (barcodeIn != "")
|
|
{
|
|
Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
|
|
switch (tipoBCode)
|
|
{
|
|
#if false
|
|
case tipoCodiceBarcode.Comando:
|
|
// verifico se il comando sia di tipo "seleziona linea"
|
|
string cmdSelLine = memLayer.ML.confReadString("cmdSelLine");
|
|
Postazione.CssClass = "stileComandoOk";
|
|
if (barcodeIn.StartsWith(cmdSelLine))
|
|
{
|
|
// allora provo ad impostare la linea!
|
|
checkSelDDL(barcodeIn.Replace(cmdSelLine, ""), true);
|
|
}
|
|
break;
|
|
#endif
|
|
case tipoCodiceBarcode.UDC:
|
|
// se linea non selezionata ERRORE!!!
|
|
if (Postazione.currCodLinea == "W2000")
|
|
{
|
|
Postazione.messaggiText += " - Attenzione, IMPOSTARE LINEA!";
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
else
|
|
{
|
|
// procedo solo se UDC esistente
|
|
if (MagClass.magazzino.checkUDC(barcodeIn))
|
|
{
|
|
// controllo IdxPosizione dell'UDC e confronto con posizione in webconfig x trattati (pre lavorazioni meccaniche)
|
|
int IdxPosizione = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].IdxPosizione;
|
|
if (IdxPosizione == memLayer.ML.confReadInt("IdxPosizioneTrattati"))
|
|
{
|
|
int idxCellaCurr = 0;
|
|
try
|
|
{
|
|
idxCellaCurr = MagClass.magazzino.taPosUdcCorr.getByUDC(barcodeIn)[0].IdxCella;
|
|
}
|
|
catch
|
|
{ }
|
|
// controllo se UDC non sia già stato spostato in posizione... ds magazzino, posiz udc corrente, get By udc
|
|
if (idxCellaCurr == Postazione.currIdxCella)
|
|
{
|
|
Postazione.messaggiText += " - Attenzione, UDC già caricato!";
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
else
|
|
{
|
|
// altrimenti procedo...
|
|
string codSogg = "";
|
|
string particolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
|
|
decimal qta = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Qta;
|
|
string noteTrim = "";
|
|
try
|
|
{
|
|
codSogg = MagClass.magazzino.CodSoggCurrUser;
|
|
}
|
|
catch
|
|
{ }
|
|
try
|
|
{
|
|
noteTrim = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Note.Trim();
|
|
}
|
|
catch
|
|
{
|
|
noteTrim = "";
|
|
}
|
|
DateTime adesso = DateTime.Now;
|
|
// se ho cod cella sposto!
|
|
MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), barcodeIn, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
|
|
// registro sposstamento UDC
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, barcodeIn, particolare, "spostaUDC", string.Format("Caricato UDC Trattati su linea {2}, qta: {0} {1} ", qta, noteTrim, Postazione.currCodLinea));
|
|
Postazione.CssClass = "stileComandoOk";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// udc NON corretto, mostro errore...
|
|
Postazione.messaggiText += " - Attenzione, UDC NON VALIDO!";
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
default:
|
|
Postazione.messaggiText += " - codice <b>non riconosciuto</b>!";
|
|
Postazione.CssClass = "stileComandoND";
|
|
break;
|
|
}
|
|
barcodeIn = "";
|
|
}
|
|
else
|
|
{
|
|
Postazione.messaggiText = traduci("AttesaBCode");
|
|
Postazione.CssClass = "stileAttesa";
|
|
}
|
|
doUpdate();
|
|
}
|
|
/// <summary>
|
|
/// aggiorna tabella + focus a barcode
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
idxCella = Postazione.currIdxCella;
|
|
grView.DataBind();
|
|
txtBarcode.Focus();
|
|
}
|
|
/// <summary>
|
|
/// wrapper per log con salvataggio dell'IP del chiamante
|
|
/// </summary>
|
|
/// <param name="_testoPre"></param>
|
|
/// <returns></returns>
|
|
public bool httpLog(string _testoPre)
|
|
{
|
|
bool answ = false;
|
|
logger.lg.scriviLog(Postazione.IP + _testoPre);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// wrapper per log con salvataggio dell'IP del chiamante
|
|
/// </summary>
|
|
/// <param name="_testoPre"></param>
|
|
/// <returns></returns>
|
|
public bool httpLog(string testoLog, tipoLog tipo)
|
|
{
|
|
bool answ = false;
|
|
logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// effettua reset dati
|
|
/// </summary>
|
|
public void doResetData()
|
|
{
|
|
// resetto i dati QtaTot e particolare...
|
|
testoRicerca = "";
|
|
doChecks();
|
|
}
|
|
/// <summary>
|
|
/// passo alla modalità OUT
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect("LavorMeccOUT.aspx");
|
|
}
|
|
/// <summary>
|
|
/// cambiato valore in ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtCerca_TextChanged(object sender, EventArgs e)
|
|
{
|
|
salvaCerca();
|
|
}
|
|
/// <summary>
|
|
/// effettuato reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lnkReset_Click(object sender, EventArgs e)
|
|
{
|
|
testoRicerca = "";
|
|
salvaCerca();
|
|
}
|
|
/// <summary>
|
|
/// pressione del button di ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnCerca_Click(object sender, EventArgs e)
|
|
{
|
|
salvaCerca();
|
|
}
|
|
|
|
/// <summary>
|
|
/// testo ricerca trimmato da spazi
|
|
/// </summary>
|
|
protected string testoRicerca
|
|
{
|
|
get
|
|
{
|
|
return txtCerca.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtCerca.Text = value;
|
|
}
|
|
}
|
|
protected void salvaCerca()
|
|
{
|
|
if (testoRicerca == "")
|
|
{
|
|
SteamWare.memLayer.ML.emptySessionVal("valoreCercatoLMI");
|
|
}
|
|
else
|
|
{
|
|
SteamWare.memLayer.ML.setSessionVal("valoreCercatoLMI", testoRicerca);
|
|
}
|
|
// raise dell'evento
|
|
if (eh_nuovaRicerca != null)
|
|
{
|
|
eh_nuovaRicerca(this, new EventArgs());
|
|
}
|
|
doUpdate();
|
|
}
|
|
protected void grView_PageIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
protected void grView_Sorted(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
/// <summary>
|
|
/// aggiorno ods al binding..
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ods_DataBinding(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
/// <summary>
|
|
/// verifica se attivo filtro company e imposta ods di conseguenza...
|
|
/// </summary>
|
|
private void checkFixOds()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// traduce gli header delle colonne
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
}
|
|
} |