diff --git a/GMW/SterrTaglioOUT.aspx b/GMW/SterrTaglioOUT.aspx index 7e2fb5c0..005f995c 100644 --- a/GMW/SterrTaglioOUT.aspx +++ b/GMW/SterrTaglioOUT.aspx @@ -1,5 +1,6 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/AjaxSimpleFull.Master" AutoEventWireup="true" CodeBehind="SterrTaglioOUT.aspx.cs" Inherits="GMW.SterrTaglioOUT" EnableEventValidation="false" %> <%@ Register src="WebUserControls/mod_SterrTagOUT.ascx" tagname="mod_SterrTagOUT" tagprefix="uc1" %> +<%@ MasterType VirtualPath="~/WebMasterPages/AjaxSimpleFull.Master" %> diff --git a/GMW/SterrTaglioOUT.aspx.cs b/GMW/SterrTaglioOUT.aspx.cs index 94ceb823..fe16776f 100644 --- a/GMW/SterrTaglioOUT.aspx.cs +++ b/GMW/SterrTaglioOUT.aspx.cs @@ -12,5 +12,20 @@ namespace GMW protected void Page_Load(object sender, EventArgs e) { } + + protected void Page_PreInit(object sender, EventArgs e) + { + // Create an event handler for the master page's contentCallEvent event + Master.eh_doRefresh += new EventHandler(Master_eh_doRefresh); + } + /// + /// chiamo update in modulo interno + /// + /// + /// + private void Master_eh_doRefresh(object sender, EventArgs e) + { + mod_SterrTagOUT1.doRefreshBloccoPost(); + } } } \ No newline at end of file diff --git a/GMW/SterrTaglioOUT.aspx.designer.cs b/GMW/SterrTaglioOUT.aspx.designer.cs index 70a48931..1155fc90 100644 --- a/GMW/SterrTaglioOUT.aspx.designer.cs +++ b/GMW/SterrTaglioOUT.aspx.designer.cs @@ -20,5 +20,17 @@ namespace GMW { /// To modify move field declaration from designer file to code-behind file. /// protected global::GMW.WebUserControls.mod_SterrTagOUT mod_SterrTagOUT1; + + /// + /// Master property. + /// + /// + /// Auto-generated property. + /// + public new GMW.WebMasterPages.AjaxSimpleFull Master { + get { + return ((GMW.WebMasterPages.AjaxSimpleFull)(base.Master)); + } + } } } diff --git a/GMW/WebMasterPages/AjaxSimpleFull.Master.cs b/GMW/WebMasterPages/AjaxSimpleFull.Master.cs index 4e406bf7..59c38520 100644 --- a/GMW/WebMasterPages/AjaxSimpleFull.Master.cs +++ b/GMW/WebMasterPages/AjaxSimpleFull.Master.cs @@ -9,9 +9,24 @@ namespace GMW.WebMasterPages { public partial class AjaxSimpleFull : System.Web.UI.MasterPage { + public event EventHandler eh_doRefresh; protected void Page_Load(object sender, EventArgs e) { Page.Title = SteamWare.memLayer.ML.confReadString("_titoloPagina"); + mod_menuBottomFullpage1.eh_doRefresh += mod_menuBottomFullpage1_eh_doRefresh; + } + /// + /// evento (agganciabile) di refresh pagina + /// + /// + /// + void mod_menuBottomFullpage1_eh_doRefresh(object sender, EventArgs e) + { + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } } } } diff --git a/GMW/WebMasterPages/AjaxSimpleFull.Master.designer.cs b/GMW/WebMasterPages/AjaxSimpleFull.Master.designer.cs index 1e2d5446..9a39b18a 100644 --- a/GMW/WebMasterPages/AjaxSimpleFull.Master.designer.cs +++ b/GMW/WebMasterPages/AjaxSimpleFull.Master.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4971 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ diff --git a/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs b/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs index 942c4d57..3551127d 100644 --- a/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs +++ b/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs @@ -80,13 +80,11 @@ namespace GMW.WebUserControls { checkSelDDL(currCodLinea, false); MagClass.magazzino.taAL.updatePost(currCodLinea, postazione_name); - //ddlLinea.DataBind(); } else { // resetto uso postazione... MagClass.magazzino.taAL.resetPost(postazione_name); - //odsLinea.DataBind(); } } doChecks(); @@ -630,6 +628,7 @@ namespace GMW.WebUserControls { Response.Redirect("~/menu.aspx"); } + doRefreshBloccoPost(); } /// /// effettua il consumo di tutti gli UDC inviati come array di stringhe @@ -783,7 +782,6 @@ namespace GMW.WebUserControls Response.Redirect("SterrTaglioIN.aspx"); } - /// /// selezione di una linea da elenco DropDownList /// @@ -799,43 +797,95 @@ namespace GMW.WebUserControls /// private void checkSelDDL(string codLinea, bool doSave) { - // controllo se la linea sia libera.. minutiBloccoLinea - - //...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"; - } - catch - { - // mostro errore - lblMessaggi.Text = string.Format("Errore selezione linea: codice {0} non trovato!", codLinea); - pnlAll.CssClass = "stileComandoKo"; - } - if (doSave) - { - // resetto usi linee precedenti.. - MagClass.magazzino.taAL.resetPost(postazione_name); - // salvo su DB che sto occupando linea... - MagClass.magazzino.taAL.updatePost(codLinea, postazione_name); - // ricarico elenco postazioni... - ddlLinea.DataBind(); - // continuo - currCodLinea = codLinea; - testoRicerca = ""; - grView.DataBind(); - salvaCerca(); - } - // salvo codice cella! - try - { - codCella = MagClass.magazzino.taAL.getByKey(currCodLinea)[0].CodCella; - idxCella = MagClass.magazzino.taCelle.getByCodCella(codCella)[0].IdxCella; + 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 { } - doUpdate(); + if (lineaLibera) + { + //...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 + currCodLinea = codLinea; + testoRicerca = ""; + grView.DataBind(); + salvaCerca(); + } + // salvo codice cella! + try + { + codCella = MagClass.magazzino.taAL.getByKey(currCodLinea)[0].CodCella; + idxCella = MagClass.magazzino.taCelle.getByCodCella(codCella)[0].IdxCella; + } + catch + { + codCella = ""; + idxCella = 0; + } + doUpdate(); + } + 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; + } + } + /// + /// 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(); } /// /// CODICE cella associata alla linea corrente @@ -1046,6 +1096,13 @@ namespace GMW.WebUserControls //testoRicerca = newPart; updFiltroPart(newPart); } + /// + /// fa su richiesta un refresh (aggiornando dataOra di blocco x cella/posizione ad esempio) + /// + public void doRefreshBloccoPost() + { + refreshBloccoPost(currCodLinea); + } } } \ No newline at end of file diff --git a/GMW/WebUserControls/mod_menuBottomFullpage.ascx.cs b/GMW/WebUserControls/mod_menuBottomFullpage.ascx.cs index f5c94d20..fb29216b 100644 --- a/GMW/WebUserControls/mod_menuBottomFullpage.ascx.cs +++ b/GMW/WebUserControls/mod_menuBottomFullpage.ascx.cs @@ -14,6 +14,8 @@ namespace GMW.WebUserControls { public partial class mod_menuBottomFullpage : ApplicationUserControl { + public event EventHandler eh_doRefresh; + protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); @@ -33,6 +35,11 @@ namespace GMW.WebUserControls protected void Timer1_Tick(object sender, EventArgs e) { setClock(); + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } } private void setClock() diff --git a/GMW/bin/GMW.dll b/GMW/bin/GMW.dll index 4e9de2e5..be42b747 100644 Binary files a/GMW/bin/GMW.dll and b/GMW/bin/GMW.dll differ