905 lines
34 KiB
C#
905 lines
34 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using GMW_data;
|
|
|
|
namespace GMW.WebUserControls
|
|
{
|
|
public partial class mod_PostFinMultOUT : GMW_data.UserControl
|
|
{
|
|
/// <summary>
|
|
/// flusso associato (hard coded) a FUSI
|
|
/// </summary>
|
|
protected string flusso = "FI";
|
|
/// <summary>
|
|
/// stato associato (hard coded) a FUSI
|
|
/// </summary>
|
|
protected string statoUDC = "Fin";
|
|
/// <summary>
|
|
/// tipo di evento associato alla creazione dell'UDC
|
|
/// </summary>
|
|
protected string eventoUDC = "UDC_FINITO";
|
|
/// <summary>
|
|
/// dati x verifica CodSoggetto / matricola
|
|
/// </summary>
|
|
protected string preCodSogg = memLayer.ML.confReadString("prefCodSogg");
|
|
|
|
public event EventHandler eh_reqUpdate;
|
|
|
|
/// <summary>
|
|
/// caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
Postazione.messaggiText = "";
|
|
Postazione.warningText = "";
|
|
traduciObj();
|
|
CodBlocco = Postazione.currCodBlocco;
|
|
checkNumKeyIn();
|
|
// reimposto eventuale particolare...?!?
|
|
currParticolare = "";// currParticolare;
|
|
grView.DataSourceID = "ods";
|
|
lblUdcParent.Text = traduci("UDC");
|
|
}
|
|
doChecks();
|
|
}
|
|
/// <summary>
|
|
/// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
|
|
/// </summary>
|
|
private void checkNumKeyIn()
|
|
{
|
|
if (memLayer.ML.isInSessionObject("numKeyIn"))
|
|
{
|
|
barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
|
|
// svuoto valore in sessione...
|
|
memLayer.ML.emptySessionVal("numKeyIn");
|
|
// controllo barcode...
|
|
checkBarcode();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// CodBLocco associato alla linea corrente
|
|
/// </summary>
|
|
protected string CodBlocco
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (memLayer.ML.isInSessionObject("CodBloccoLineaLFM_OUT"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("CodBloccoLineaLFM_OUT");
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("CodBloccoLineaLFM_OUT", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// richiesta (ri)stampa UDC
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void ristampa()
|
|
{
|
|
bool fatto = false;
|
|
// 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;
|
|
fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finito LM OUT {0}", udcReq), tipoLog.EXCEPTION);
|
|
}
|
|
if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finito LM OUT");
|
|
// raise dell'evento
|
|
if (eh_reqUpdate != null)
|
|
{
|
|
eh_reqUpdate(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// udc da stampare
|
|
/// </summary>
|
|
protected string udcReq
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("udcSelSAO");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// controlla particolare selezionato
|
|
/// </summary>
|
|
private void checkParticolare()
|
|
{
|
|
if (currParticolare != "")
|
|
{
|
|
lblParticolareAttivo.Text = string.Format("<b>{0}</b>", currParticolare);
|
|
//lblParticolareAttivo.Text = string.Format("Particolare selezionato <b>{0}</b>", currParticolare);
|
|
lblPart.Text = currParticolare;
|
|
// aggiungo descrizione del particolare
|
|
string descr = "";
|
|
string disegno = "";
|
|
try
|
|
{
|
|
DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
|
|
descr = riga.DescParticolare;
|
|
disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
|
|
}
|
|
catch
|
|
{ }
|
|
lblDescrAttivo.Text = descr;
|
|
lblDisegno.Text = disegno;
|
|
}
|
|
else
|
|
{
|
|
lblParticolareAttivo.Text = "...";
|
|
lblDescrAttivo.Text = "";
|
|
lblDisegno.Text = "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua controlli visibilità
|
|
/// </summary>
|
|
private void doChecks()
|
|
{
|
|
checkBarcode();
|
|
checkStampa();
|
|
checkParticolare();
|
|
}
|
|
/// <summary>
|
|
/// sistemo labels oggetti
|
|
/// </summary>
|
|
private void traduciObj()
|
|
{
|
|
//txtBox
|
|
txtQta.Text = memLayer.ML.confReadString("QtaImballoFiniti");
|
|
// buttons
|
|
btnEmptyNote.Text = traduci("btnEmptyNote");
|
|
}
|
|
/// <summary>
|
|
/// indica il codice articolo correntemente selezionato
|
|
/// </summary>
|
|
protected string currParticolare
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj(string.Format("currParticolare_{0}", uid));
|
|
//return hfCurrPart.Value;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("currParticolare_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
|
|
hfCurrPart.Value = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica data minima ingresso x validità UDC
|
|
/// </summary>
|
|
protected DateTime minDt
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToDateTime(hfMinDt.Value);
|
|
}
|
|
set
|
|
{
|
|
hfMinDt.Value = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica data minima ingresso x validità UDC
|
|
/// </summary>
|
|
protected DateTime maxDt
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToDateTime(hfMaxDt.Value);
|
|
}
|
|
set
|
|
{
|
|
hfMaxDt.Value = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica il numero max di UDC x cella
|
|
/// </summary>
|
|
protected int num4Cell
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToInt32(hfNum4Cell.Value);
|
|
}
|
|
set
|
|
{
|
|
hfNum4Cell.Value = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// num pezzi dell'ultimo UDC del particolare generato
|
|
/// </summary>
|
|
public int pezziUdc
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// cod imballo dell'ultimo UDC del particolare generato
|
|
/// </summary>
|
|
public string lastCodImb
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].CodImballo;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// decodifica il tipo barcode acquisito
|
|
/// </summary>
|
|
public tipoCodiceBarcode tipoBCode
|
|
{
|
|
get
|
|
{
|
|
tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
|
|
int trovati = 0;
|
|
int matricola = -1;
|
|
// provo a convertire in intero barcode x verifica eventuale matricola...
|
|
try
|
|
{
|
|
matricola = Convert.ToInt32(barcodeIn);
|
|
}
|
|
catch
|
|
{ }
|
|
// controllo non si tratti di un comando...
|
|
string preCmd = memLayer.ML.cdv("prefComandi");
|
|
if (barcodeIn.StartsWith(preCmd))
|
|
{
|
|
answ = tipoCodiceBarcode.Comando;
|
|
}
|
|
else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
|
|
{
|
|
answ = tipoCodiceBarcode.Particolare;
|
|
}
|
|
// controllo se sia un codice IMBALLO
|
|
else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
|
|
{
|
|
// è imballo!
|
|
answ = tipoCodiceBarcode.Imballo;
|
|
}
|
|
else if (barcodeIn.StartsWith(preCodSogg))
|
|
{
|
|
// cerco cod soggetto...
|
|
if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
|
|
{
|
|
answ = tipoCodiceBarcode.Operatore;
|
|
}
|
|
}
|
|
else if (matricola >= 0)
|
|
{
|
|
if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
|
|
{
|
|
answ = tipoCodiceBarcode.Operatore;
|
|
}
|
|
}
|
|
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>
|
|
/// qta pezzi TOTALE
|
|
/// </summary>
|
|
public int qta
|
|
{
|
|
get
|
|
{
|
|
int qta = 0;
|
|
try
|
|
{
|
|
qta = Convert.ToInt32(txtQta.Text.Trim());
|
|
}
|
|
catch
|
|
{ }
|
|
return qta;
|
|
}
|
|
set
|
|
{
|
|
txtQta.Text = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// controlla se ci sia un barcode
|
|
/// </summary>
|
|
private void checkBarcode()
|
|
{
|
|
if (barcodeIn != "")
|
|
{
|
|
Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
|
|
switch (tipoBCode)
|
|
{
|
|
case tipoCodiceBarcode.Comando:
|
|
if (barcodeIn == memLayer.ML.confReadString("cmdReset"))
|
|
{
|
|
currParticolare = "";
|
|
Response.Redirect(PagCorrente);
|
|
}
|
|
break;
|
|
case tipoCodiceBarcode.Imballo:
|
|
// cerco di selezionare!
|
|
try
|
|
{
|
|
ddlImballi.SelectedValue = barcodeIn;
|
|
}
|
|
catch
|
|
{
|
|
Postazione.warningText = traduci("ERR-IMB-001");
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
break;
|
|
case tipoCodiceBarcode.Particolare:
|
|
// imposto il particolare corrente
|
|
currParticolare = barcodeIn;
|
|
processParticolare();
|
|
break;
|
|
case tipoCodiceBarcode.UDC:
|
|
// procedo solo se UDC esistente
|
|
if (MagClass.magazzino.checkUDC(barcodeIn))
|
|
{
|
|
// calcolo nuovo particolare
|
|
currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
|
|
processParticolare();
|
|
}
|
|
|
|
break;
|
|
case tipoCodiceBarcode.Operatore:
|
|
// calcolo matricola utente
|
|
int MatrUtente = -1;
|
|
string preCodSogg = memLayer.ML.confReadString("prefCodSogg");
|
|
if (barcodeIn.StartsWith(preCodSogg))
|
|
{
|
|
MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
|
|
}
|
|
else
|
|
{
|
|
MatrUtente = Convert.ToInt32(barcodeIn);
|
|
}
|
|
if (MatrUtente >= 0)
|
|
{
|
|
// salvo in sessione operatore con AUTH
|
|
OpAuth.startOpAuth(MatrUtente);
|
|
// mostro che ho autorizzato...
|
|
Postazione.messaggiText += traduci("userAuthRec");
|
|
Postazione.CssClass = "stileComandoOk";
|
|
Response.Redirect(user_std.pagCorrente);
|
|
}
|
|
else
|
|
{
|
|
Postazione.messaggiText += " - codice <b>non riconosciuto</b>!";
|
|
Postazione.CssClass = "stileComandoND";
|
|
}
|
|
break;
|
|
default:
|
|
// cerco se sia "0" = reset utente...
|
|
if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
|
|
{
|
|
// salvo in sessione operatore con AUTH
|
|
OpAuth.stopAuth();
|
|
// mostro che ho autorizzato...
|
|
Postazione.messaggiText += traduci("userAuthRem");
|
|
Postazione.CssClass = "stileComandoOk";
|
|
Response.Redirect(user_std.pagCorrente);
|
|
}
|
|
Postazione.messaggiText += " - codice <b>non riconosciuto</b>!";
|
|
Postazione.CssClass = "stileComandoND";
|
|
break;
|
|
}
|
|
barcodeIn = "";
|
|
}
|
|
else
|
|
{
|
|
Postazione.messaggiText = traduci("AttesaBCode");
|
|
Postazione.CssClass = "stileAttesa";
|
|
}
|
|
txtBarcode.Focus();
|
|
}
|
|
/// <summary>
|
|
/// Processa nuovo particoalre letto...
|
|
/// </summary>
|
|
private void processParticolare()
|
|
{
|
|
impostaParticolare();
|
|
// cambio titolo x UDC aprent...
|
|
lblUdcParent.Text = traduci("UdcParentEffett");
|
|
|
|
// salvo tutti i valori dei parametri attuali e cambio ods x grView...
|
|
minDt = DateTime.Now.AddMinutes(-maxTime);
|
|
maxDt = DateTime.Now.AddMinutes(-minTime);
|
|
num4Cell = memLayer.ML.CRI("num4Cell");
|
|
|
|
// modifico per mostrare selezione degli UDC associabili a SX (non troppo vecchi ne nuovi, con num max x ogni linea)
|
|
grView.DataSourceID = "odsSpec";
|
|
grView.DataBind();
|
|
|
|
// controllo che ci sia almeno un UDC in IN da associare, sennò errore!!!
|
|
if (grView.Rows.Count == 0)
|
|
{
|
|
currParticolare = "";
|
|
Postazione.messaggiText += " - codice particolare non valido / non trovati UDC in ingresso.";
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// Valore negativo di minuti da sottrarre ad ADESSO x valore MASSIMO finestra dataOra ammissibile
|
|
/// </summary>
|
|
public int maxTime { get; set; }
|
|
/// <summary>
|
|
/// Valore negativo di minuti da sottrarre ad ADESSO x valore MINIMO finestra dataOra ammissibile
|
|
/// </summary>
|
|
public int minTime { get; set; }
|
|
/// <summary>
|
|
/// imposto i dati dal particolare corrente
|
|
/// </summary>
|
|
private void impostaParticolare()
|
|
{
|
|
// controllo esista il particolare scansionato
|
|
if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
|
|
{
|
|
currParticolare = "";
|
|
Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
|
|
Postazione.CssClass = "stileComandoKo";
|
|
}
|
|
else
|
|
{
|
|
Postazione.messaggiText += " - impostato particolare!";
|
|
Postazione.CssClass = "stileComandoOk";
|
|
}
|
|
// leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
|
|
if (pezziUdc > 0)
|
|
{
|
|
txtQta.Text = pezziUdc.ToString();
|
|
}
|
|
else // rimette default
|
|
{
|
|
txtQta.Text = memLayer.ML.confReadString("QtaImballoFiniti");
|
|
}
|
|
if (lastCodImb != "")
|
|
{
|
|
selezionaImballo();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// aggiorna tabella + focus a barcode
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
CodBlocco = Postazione.currCodBlocco;
|
|
checkStampa();
|
|
grView.DataBind();
|
|
txtBarcode.Focus();
|
|
// raise dell'evento
|
|
if (eh_reqUpdate != null)
|
|
{
|
|
eh_reqUpdate(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
public bool isExcluded(object dateTimeIn)
|
|
{
|
|
bool answ = false;
|
|
DateTime dtIN = DateTime.Today;
|
|
DateTime adesso = DateTime.Now;
|
|
try
|
|
{
|
|
dtIN = Convert.ToDateTime(dateTimeIn);
|
|
}
|
|
catch
|
|
{ }
|
|
// controllo DataOra IN nella linea multipla: se è < minimo tempo attraversamento oppure > max tempo attraversamento (da web.config) DEVE ESSERE BARRATA come ESCLUSA...
|
|
double etaUdc = adesso.Subtract(dtIN).TotalMinutes;
|
|
if (etaUdc < minTime || etaUdc > maxTime)
|
|
{
|
|
answ = true;
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// controllo l'abilitazione alla stampa UDC:
|
|
/// - particolare ok
|
|
/// - qta > 0
|
|
/// - udc da consumo totale/parziale
|
|
/// altrimenti disabilito btn stampa
|
|
/// </summary>
|
|
private void checkStampa()
|
|
{
|
|
bool stampaOk = false;
|
|
//controllo siano inseriti valori qta
|
|
if (qta > 0)
|
|
{
|
|
// controllo se ho almeno 1 UDC associabile in INput...
|
|
if(grView.Rows.Count>0)
|
|
{
|
|
stampaOk = true;
|
|
}
|
|
}
|
|
divNote.Visible = stampaOk;
|
|
}
|
|
/// <summary>
|
|
/// genera i barcode di
|
|
/// - trattamenti
|
|
/// - nuovo x pezzi liquidi
|
|
/// e lancia la relativa stampa
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnStampa_Click(object sender, EventArgs e)
|
|
{
|
|
bool needsRedirect = false;
|
|
// verifico postazione x procedere...
|
|
if (Postazione.printer != "n.d.")
|
|
{
|
|
// verifico auth utente OPPURE se NON sia richiesta...
|
|
if (OpAuth.isAuth || !OpAuth.opAuthReq)
|
|
{
|
|
// ri-controllo particolare
|
|
if (currParticolare != "")
|
|
{
|
|
// ri controllo di avere UDC associabili
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
string newUdcChild = "";
|
|
int qta = memLayer.ML.confReadInt("QtaImballoFiniti");
|
|
string noteTrim = txtNote.Text.Trim();
|
|
noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
|
|
try
|
|
{
|
|
qta = Convert.ToInt32(txtQta.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
// effettuo controlli che cod_soggetto e cod particolare siano disponibili...
|
|
string codSogg = "";
|
|
string particolare = "";
|
|
try
|
|
{
|
|
codSogg = MagClass.magazzino.CodSoggCurrUser;
|
|
particolare = currParticolare;
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
if (codSogg != "" && particolare != "")
|
|
{
|
|
// genero cartellino
|
|
DateTime adesso = DateTime.Now;
|
|
try
|
|
{
|
|
string codImballo = "";
|
|
try
|
|
{
|
|
codImballo = ddlImballi.SelectedValue;
|
|
}
|
|
catch
|
|
{
|
|
codImballo = memLayer.ML.confReadString("CodImballoFiniti");
|
|
}
|
|
// se NON HA selezionato prendo default...
|
|
if (codImballo == "" || codImballo == "-")
|
|
{
|
|
codImballo = memLayer.ML.confReadString("CodImballoFiniti");
|
|
}
|
|
// creo nuovo UDC FINITO OUT multiple
|
|
newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, codImballo, "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.confReadInt("IdxPosizioneFiniti"), "IdxPosizioneFiniti", eventoUDC, noteTrim, "", adesso.Year, Request.UserHostName);
|
|
|
|
if (OpAuth.isAuth)
|
|
{
|
|
// salvo attributo dell'OpAuth...
|
|
MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
|
|
// consumo una auth...
|
|
OpAuth.currAuth.remAuth--;
|
|
if (OpAuth.currAuth.remAuth == 0)
|
|
{
|
|
OpAuth.stopAuth();
|
|
needsRedirect = true;
|
|
}
|
|
}
|
|
|
|
// registro creazione nuovo UDC
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Finito LM OUT, qta: {0} {1}", qta, noteTrim));
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
httpLog(string.Format("Errore creazione UDC Finito LM OUT: {0}", exc), tipoLog.EXCEPTION);
|
|
}
|
|
// devo gestire associazione e consumo cartellini INPUT
|
|
if (newUdcChild != "")
|
|
{
|
|
// recupero TUTTI gli UDC parent...
|
|
DS_magazzino.v_UdcDetailDataTable tab= MagClass.magazzino.taDettUDC.getByCodBloccoPeriodoMult(CodCs, CodBlocco, currParticolare, minDt, maxDt, num4Cell);
|
|
//se li trova...
|
|
if (tab.Rows.Count > 0)
|
|
{
|
|
// uno alla volta li associo...
|
|
foreach (DS_magazzino.v_UdcDetailRow riga in tab)
|
|
{
|
|
associaUdc(newUdcChild, riga.UDC);
|
|
}
|
|
}
|
|
|
|
// ora stampo il nuovo cartellino!!!
|
|
MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartFiniti, Request.UserHostName);
|
|
// incremento timing...
|
|
adesso = DateTime.Now;
|
|
adesso = adesso.AddSeconds(2);
|
|
// registro stampa nuovo UDC
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Finito LM OUT");
|
|
}
|
|
// resetto
|
|
doResetData();
|
|
}
|
|
else
|
|
{
|
|
httpLog(string.Format("Finiti LM OUT, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
|
|
Response.Redirect("~/login.aspx");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
httpLog(string.Format("Finiti LM OUT, Errore controllo UDC associabili!"), tipoLog.ERROR);
|
|
Postazione.messaggiText += "Errore controllo UDC associabili";
|
|
Postazione.CssClass = "stileComandoND";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
httpLog(string.Format("Finiti LM OUT, Errore controllo particolare!"), tipoLog.ERROR);
|
|
Postazione.messaggiText += "Errore controllo particolare";
|
|
Postazione.CssClass = "stileComandoND";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Postazione.messaggiText = traduci("noOpAuth");
|
|
Postazione.CssClass = "stileComandoKo";
|
|
httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("~/menu.aspx");
|
|
}
|
|
doUpdate();
|
|
// raise dell'evento
|
|
if (eh_reqUpdate != null)
|
|
{
|
|
eh_reqUpdate(this, new EventArgs());
|
|
}
|
|
if (needsRedirect)
|
|
{
|
|
Response.Redirect(user_std.pagCorrente);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua consumo UDC
|
|
/// </summary>
|
|
/// <param name="oldUdc"></param>
|
|
private void consumaUdc(string oldUdc)
|
|
{
|
|
// se è consumabile (IdxPosizione > 0)...
|
|
if (MagClass.magazzino.udcMpIsConsumabile(oldUdc))
|
|
{
|
|
// consumo UDC
|
|
MagClass.magazzino.scaricaUdcMpWip(oldUdc, Request.UserHostName);
|
|
}
|
|
}
|
|
/// <summary>
|
|
///associa nuovo UDC ad elenco UDC
|
|
/// </summary>
|
|
/// <param name="newUdcChild">UDC da associare come child</param>
|
|
/// <param name="UDC_P">vettore di UDC da associare come parent</param>
|
|
private void associaUdc(string newUdcChild, string UDC_Parent)
|
|
{
|
|
// se UDC è NON vuoto ed esiste
|
|
if (UDC_Parent != "" && MagClass.magazzino.checkUDC(UDC_Parent))
|
|
{
|
|
MagClass.magazzino.associaUdcParent(newUdcChild, UDC_Parent, true);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua reset dati
|
|
/// </summary>
|
|
public void doResetData()
|
|
{
|
|
// resetto i dati QtaTot e particolare...
|
|
qta = 0;
|
|
currParticolare = "";
|
|
grView.DataSourceID = "ods";
|
|
lblUdcParent.Text = traduci("UDC");
|
|
txtQta.Text = "";
|
|
doChecks();
|
|
}
|
|
/// <summary>
|
|
/// svuoto le note
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnEmptyNote_Click(object sender, EventArgs e)
|
|
{
|
|
txtNote.Text = "";
|
|
Postazione.messaggiText = traduci("AttesaBCode");
|
|
Postazione.CssClass = "stileAttesa";
|
|
// raise dell'evento
|
|
if (eh_reqUpdate != null)
|
|
{
|
|
eh_reqUpdate(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua refresh (su db) del blocco postazione
|
|
/// </summary>
|
|
/// <param name="codLinea"></param>
|
|
private void refreshBloccoPost(string codLinea)
|
|
{
|
|
// resetto usi linee precedenti..
|
|
MagClass.magazzino.taAL.resetPost(Postazione.name);
|
|
// se la linea non è "base" = "Sel linea", finisce x "0"
|
|
if (codLinea.Substring(codLinea.Length - 1) != "0")
|
|
{
|
|
// salvo su DB che sto occupando linea...
|
|
MagClass.magazzino.taAL.updatePost(codLinea, Postazione.name);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// cambio indice pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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 = "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// preseleziono (se possibile) imballo...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlImballi_DataBound(object sender, EventArgs e)
|
|
{
|
|
selezionaImballo();
|
|
}
|
|
/// <summary>
|
|
/// seleziona imballo corretto
|
|
/// </summary>
|
|
private void selezionaImballo()
|
|
{
|
|
string codImb = "";
|
|
// cerco se c'è un imballo x particolare corrente...
|
|
if (currParticolare != "")
|
|
{
|
|
codImb = lastCodImb;
|
|
}
|
|
else
|
|
{
|
|
codImb = memLayer.ML.confReadString("CodImballoFiniti");
|
|
}
|
|
try
|
|
{
|
|
// preseleziono
|
|
ddlImballi.SelectedValue = codImb;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
} |