compeltamento blocco posstazioni sterratura

- aggiorna postazione a ogni refresh apgina
- controlalti casi di blocco/sblocco/sovrascritture
This commit is contained in:
Samuele Locatelli
2014-02-10 10:53:37 +01:00
parent e15a02ccb5
commit 1d5b45f742
8 changed files with 143 additions and 37 deletions
+1
View File
@@ -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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<uc1:mod_SterrTagOUT ID="mod_SterrTagOUT1" runat="server" />
</asp:Content>
+15
View File
@@ -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);
}
/// <summary>
/// chiamo update in modulo interno
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Master_eh_doRefresh(object sender, EventArgs e)
{
mod_SterrTagOUT1.doRefreshBloccoPost();
}
}
}
+12
View File
@@ -20,5 +20,17 @@ namespace GMW {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::GMW.WebUserControls.mod_SterrTagOUT mod_SterrTagOUT1;
/// <summary>
/// Master property.
/// </summary>
/// <remarks>
/// Auto-generated property.
/// </remarks>
public new GMW.WebMasterPages.AjaxSimpleFull Master {
get {
return ((GMW.WebMasterPages.AjaxSimpleFull)(base.Master));
}
}
}
}
@@ -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;
}
/// <summary>
/// evento (agganciabile) di refresh pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
}
}
}
+1 -2
View File
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
+92 -35
View File
@@ -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();
}
/// <summary>
/// effettua il consumo di tutti gli UDC inviati come array di stringhe
@@ -783,7 +782,6 @@ namespace GMW.WebUserControls
Response.Redirect("SterrTaglioIN.aspx");
}
/// <summary>
/// selezione di una linea da elenco DropDownList
/// </summary>
@@ -799,43 +797,95 @@ namespace GMW.WebUserControls
/// <param name="p"></param>
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;
}
}
/// <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);
}
// ricarico elenco postazioni...
ddlLinea.DataBind();
}
/// <summary>
/// CODICE cella associata alla linea corrente
@@ -1046,6 +1096,13 @@ namespace GMW.WebUserControls
//testoRicerca = newPart;
updFiltroPart(newPart);
}
/// <summary>
/// fa su richiesta un refresh (aggiornando dataOra di blocco x cella/posizione ad esempio)
/// </summary>
public void doRefreshBloccoPost()
{
refreshBloccoPost(currCodLinea);
}
}
}
@@ -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()
BIN
View File
Binary file not shown.