diff --git a/GMW/PostRX.aspx.cs b/GMW/PostRX.aspx.cs index 25b0d728..86ca73a8 100644 --- a/GMW/PostRX.aspx.cs +++ b/GMW/PostRX.aspx.cs @@ -36,12 +36,31 @@ namespace GMW fixStorico(); // imposto pos abilitata x cancellazione mod_storicoAzioniOperatore1.idxPosizione2del = memLayer.ML.confReadInt("IdxPosizioneRX"); + // se c'è imposto linea da sessione + checkLinea(); } mod_storicoAzioniOperatore1.eh_nascondi += mod_storicoAzioniOperatore1_eh_nascondi; mod_storicoAzioniOperatore1.eh_stampa += new EventHandler(mod_storicoAzioniOperatore1_eh_stampa); mod_PostRX_NT1.eh_reqUpdate += mod_PostRX_NT1_eh_reqUpdate; } /// + /// verifica linea corretta + /// + private void checkLinea() + { + // se c'è imposto linea da sessione + if (Postazione.currCodLinea != "") + { + MagClass.magazzino.taAL.updatePost(Postazione.currCodLinea, Postazione.name); + checkSelDDL(Postazione.currCodLinea, false); + } + else + { + // resetto uso postazione... + MagClass.magazzino.taAL.resetPost(Postazione.name); + } + } + /// /// richiesta update del controllo SAO /// /// @@ -195,36 +214,100 @@ namespace GMW /// private void checkSelDDL(string codLinea, bool doSave) { - //...aggiorno ddl + /******************************************************* + * controllo se la linea sia libera .. OVVERO: + * - nessuna postazione la occupa + * - è bloccata da + di "minutiBloccoLinea" (e quindi sovrascrivo) + * + *******************************************************/ + bool lineaLibera = false; try { - ddlLinea.SelectedValue = codLinea; - pnlAll.CssClass = "stileAttesa"; + DS_magazzino.AnagLineeRow riga = MagClass.magazzino.taAL.getByKey(codLinea)[0]; + if (riga.codPostazione == "" || riga.codPostazione == Postazione.name) + { + lineaLibera = true; + } + else + { + // controllo se è bloccata da tempo > minutiBloccoLinea --> ignoro blocco! + if (DateTime.Now >= riga.dtAccess.AddMinutes(memLayer.ML.confReadInt("minutiBloccoLinea"))) + { + lineaLibera = true; + } + } } catch + { } + if (lineaLibera) { - // mostro errore - lblMessaggi.Text = string.Format("Errore selezione linea: codice {0} non trovato!", codLinea); - pnlAll.CssClass = "stileComandoKo"; + //...aggiorno ddl + try + { + ddlLinea.SelectedValue = codLinea; + pnlAll.CssClass = "stileAttesa"; + } + catch + { + // mostro errore + lblMessaggi.Text = string.Format("Errore selezione linea: codice {0} non trovato!", codLinea); + pnlAll.CssClass = "stileComandoKo"; + } + if (doSave) + { + refreshBloccoPost(codLinea); + // continuo + Postazione.currCodLinea = codLinea; +#if false + testoRicerca = ""; + grView.DataBind(); + salvaCerca(); +#endif + } + // salvo codice cella! + try + { + codCella = MagClass.magazzino.taAL.getByKey(Postazione.currCodLinea)[0].CodCella; + idxCella = MagClass.magazzino.taCelle.getByCodCella(codCella)[0].IdxCella; + } + catch + { + codCella = ""; + idxCella = 0; + MagClass.magazzino.taAL.resetPost(Postazione.name); + } + doUpdate(); } - if (doSave) - { - currCodLinea = codLinea; - } - // salvo codice cella! - try - { - codCella = MagClass.magazzino.taAL.getByKey(currCodLinea)[0].CodCella; - idxCella = MagClass.magazzino.taCelle.getByCodCella(codCella)[0].IdxCella; - } - catch + else { codCella = ""; idxCella = 0; + MagClass.magazzino.taAL.resetPost(Postazione.name); + // mostro errore + lblMessaggi.Text = string.Format("Errore: linea {0} già impegnata, sbloccare postazione o attendere timeout!", codLinea); + pnlAll.CssClass = "stileComandoKo"; + ddlLinea.DataBind(); + ddlLinea.SelectedIndex = 0; } - doUpdate(); } + /// + /// effettua refresh (su db) del blocco postazione + /// + /// + 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); + } + // ricarico elenco postazioni... + ddlLinea.DataBind(); + } private void doUpdate() { mod_PostRX_NT1.doUpdate();// HARD CODED, raddoppiare? @@ -267,6 +350,7 @@ namespace GMW memLayer.ML.setSessionVal("IdxCellaLineaRX", value); } } +#if false /// /// codice della linea corrente /// @@ -285,7 +369,8 @@ namespace GMW { memLayer.ML.setSessionVal(string.Format("LineaIn-{0}", uid), value); } - } + } +#endif /// /// calcola postazione corrente (ip, name, printer) diff --git a/GMW/WebUserControls/mod_PostRX_NT.ascx.cs b/GMW/WebUserControls/mod_PostRX_NT.ascx.cs index 13e1dc12..63cca9ea 100644 --- a/GMW/WebUserControls/mod_PostRX_NT.ascx.cs +++ b/GMW/WebUserControls/mod_PostRX_NT.ascx.cs @@ -34,15 +34,8 @@ namespace GMW.WebUserControls { fixRicercaUdc(); traduciObj(); -#if false - storicoVisibile = false; - fixStorico(); -#endif } doChecks(); -#if false - mod_storicoAzioniOperatore1.eh_stampa += new EventHandler(mod_storicoAzioniOperatore1_eh_stampa); -#endif } /// /// verifica se si debab mostrare un campo ricerca UDC attivo... @@ -101,10 +94,6 @@ namespace GMW.WebUserControls private void traduciObj() { btnCerca.Text = traduci("btnSearch"); -#if false - // fix storico - fixStorico(); -#endif } /// /// restituisce il nome della pagina corrente @@ -337,47 +326,6 @@ namespace GMW.WebUserControls // resetto i dati QtaTot e particolare... doChecks(); } -#if false - /// - /// toggle controllo storico - /// - private void fixStorico() - { - pnlSAO.Visible = storicoVisibile; - if (storicoVisibile) - { - //btnShowHideStorico.Text = traduci("btnHideStorico"); - } - else - { - //btnShowHideStorico.Text = traduci("btnShowStorico"); - } - } - /// - /// imposto visibilità pannelo storico - /// - protected bool storicoVisibile - { - get - { - return memLayer.ML.BoolSessionObj(string.Format("showHist_{0}", this.ID)); - } - set - { - memLayer.ML.setSessionVal(string.Format("showHist_{0}", this.ID), value); - } - } - /// - /// gestisco evento show/hide storico - /// - /// - /// - protected void btnShowHideStorico_Click(object sender, EventArgs e) - { - storicoVisibile = !storicoVisibile; - fixStorico(); - } -#endif /// /// passo alla modalità OUT /// diff --git a/GMW/bin/GMW.dll b/GMW/bin/GMW.dll index d82183de..86b1c09c 100644 Binary files a/GMW/bin/GMW.dll and b/GMW/bin/GMW.dll differ diff --git a/GMW/bin/GMW_data.dll b/GMW/bin/GMW_data.dll index 0dde2c6d..30f700af 100644 Binary files a/GMW/bin/GMW_data.dll and b/GMW/bin/GMW_data.dll differ diff --git a/GMW/bin/SteamWare.dll b/GMW/bin/SteamWare.dll index c925e0c5..ffc2d736 100644 Binary files a/GMW/bin/SteamWare.dll and b/GMW/bin/SteamWare.dll differ diff --git a/GMW/bin/VersGen.dll b/GMW/bin/VersGen.dll index 8a0ef641..5e54931c 100644 Binary files a/GMW/bin/VersGen.dll and b/GMW/bin/VersGen.dll differ diff --git a/GMW_data/Postazione.cs b/GMW_data/Postazione.cs index 29a7a9e8..15d4fecd 100644 --- a/GMW_data/Postazione.cs +++ b/GMW_data/Postazione.cs @@ -67,5 +67,25 @@ namespace GMW_data memLayer.ML.setSessionVal("warningText", value); } } + /// + /// codice della linea corrente + /// + public static string currCodLinea + { + get + { + string answ = ""; + if (memLayer.ML.isInSessionObject(string.Format("Linea-{0}", Postazione.IP))) + { + answ = memLayer.ML.StringSessionObj(string.Format("Linea-{0}", Postazione.IP)); + } + return answ; + } + set + { + memLayer.ML.setSessionVal(string.Format("Linea-{0}", Postazione.IP), value); + } + } + } }