diff --git a/MP-Site/MP-Site.csproj b/MP-Site/MP-Site.csproj index 17db4629..fbba65c8 100644 --- a/MP-Site/MP-Site.csproj +++ b/MP-Site/MP-Site.csproj @@ -358,13 +358,6 @@ test.aspx - - UI.aspx - ASPXCodeBehind - - - UI.aspx - ViewSwitcher.ascx ASPXCodeBehind @@ -583,13 +576,6 @@ mod_statoMacchine.ascx - - mod_UI.ascx - ASPXCodeBehind - - - mod_UI.ascx - AutoCompletamento.asmx Component @@ -862,7 +848,6 @@ - @@ -891,7 +876,6 @@ - Web.config diff --git a/MP-Site/UI.aspx b/MP-Site/UI.aspx deleted file mode 100644 index f721a4aa..00000000 --- a/MP-Site/UI.aspx +++ /dev/null @@ -1,5 +0,0 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/MAPO_empty.master" AutoEventWireup="true" CodeBehind="UI.aspx.cs" Inherits="MoonPro.UI" %> -<%@ Register src="WebUserControls/mod_UI.ascx" tagname="mod_UI" tagprefix="uc1" %> - - - diff --git a/MP-Site/UI.aspx.cs b/MP-Site/UI.aspx.cs deleted file mode 100644 index 7fdbdc69..00000000 --- a/MP-Site/UI.aspx.cs +++ /dev/null @@ -1,54 +0,0 @@ -using MapoDb; -using SteamWare; -using System; - -namespace MoonPro -{ - public partial class UI : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - // ricavo i parametri in GET x quale postazione e macchina mostrare - string idxPostazione = Request.QueryString["idxPostazione"]; - string idxMacchina = Request.QueryString["idxMacchina"]; - string barcode = Request.QueryString["barcode"]; - bool fullUrl = ((idxPostazione != "") && (idxPostazione != null) && (idxMacchina != "") && (idxMacchina != null)); - if ((idxPostazione == "") || (idxPostazione == null)) - { - // leggo da default valori postazione e macchina SE non ne avessi a disposizione da pagina... - idxPostazione = memLayer.ML.confReadString("idxPostazioneStd"); - } - if ((idxMacchina == "") || (idxMacchina == null)) - { - // leggo da default valori postazione e macchina SE non ne avessi a disposizione da pagina... - try - { - idxMacchina = DataLayer.obj.taPostazioni.getByIdxPostaz(idxPostazione)[0].IdxMacchina; - } - catch - { - idxMacchina = memLayer.ML.confReadString("idxMacchinaStd"); - } - } - if (!fullUrl) - { - //ricarico la pagina... - string urlCompleto = string.Format("~/UI.aspx?idxPostazione={0}&idxMacchina={1}", idxPostazione, idxMacchina); - if ((barcode != "") && (barcode != null)) - { - urlCompleto += string.Format("&barcode={0}", barcode); - } - Response.Redirect(urlCompleto); - } - // controllo se ci siano barcode - if ((barcode != "") && (barcode != null)) - { - mod_UI1.BarCode = barcode; - } - // inizializzo correttamente il controllo - mod_UI1.idxPostazione = idxPostazione; - mod_UI1.idxMacchina = idxMacchina; - - } - } -} diff --git a/MP-Site/UI.aspx.designer.cs b/MP-Site/UI.aspx.designer.cs deleted file mode 100644 index 75007146..00000000 --- a/MP-Site/UI.aspx.designer.cs +++ /dev/null @@ -1,25 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MoonPro -{ - - - public partial class UI { - - /// - /// mod_UI1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::MoonPro.WebUserControls.mod_UI mod_UI1; - } -} diff --git a/MP-Site/WebUserControls/mod_UI.ascx b/MP-Site/WebUserControls/mod_UI.ascx deleted file mode 100644 index 3ac5e4fd..00000000 --- a/MP-Site/WebUserControls/mod_UI.ascx +++ /dev/null @@ -1,168 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_UI.ascx.cs" Inherits="MoonPro.WebUserControls.mod_UI" %> -
- -
-
- -
-
- -
-
- -
-
-
- -
- <%--qui va l'interazione con l'utente--%> -
-
- -
- Turni Attivi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Turno Aperto -
-
- Turno Chiuso -
-
-
- <%----%> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- Cod articolo - - Nr pezzi lanciati - - Nr pezzi confermati - - Nr pezzi fatti -
- - - - - - - -
- Efficienza Globale - - Efficienza Lavoro - - Efficienza Teorica - -
- -
- -
- -
- -
- -
- -
-
- Tc Medio - - Tc Lavoro - - Tc Tecnico - - Tc impostato -
- -
- -
- -
- -
- -
- -
- -
-
-
-
diff --git a/MP-Site/WebUserControls/mod_UI.ascx.cs b/MP-Site/WebUserControls/mod_UI.ascx.cs deleted file mode 100644 index f358f66d..00000000 --- a/MP-Site/WebUserControls/mod_UI.ascx.cs +++ /dev/null @@ -1,850 +0,0 @@ -using MapoDb; -using SteamWare; -using System; - -namespace MoonPro.WebUserControls -{ - public partial class mod_UI : System.Web.UI.UserControl - { - protected string _bCode = ""; - protected MapoDb.MapoDb controllerMapo = new MapoDb.MapoDb(); - /// - /// definisce se edit abilitato x utenti "admin" - /// - protected bool adminInput - { - get - { - return memLayer.ML.BoolSessionObj("adminInput"); - } - set - { - memLayer.ML.setSessionVal("adminInput", value); - } - } - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - popolaLabels(); - checkScadenze(); - updateUI(); - updateTurni(); - } - /// - /// aggiorna classi grafiche turni - /// - protected void updateTurni() - { - } - /// - /// verifica che non siano scaduti i termini dell'input utente admine nel caso resetta titoli... - /// - private void checkScadenze() - { - DS_ProdTempi.PostazioniMapoRow rigaPost = DataLayer.obj.taPostazioni.getByIdxPostaz(idxPostazione)[0]; - if (rigaPost == null) - { - logger.lg.scriviLog(string.Format("Errore: manca record postazione per {0}", idxPostazione), tipoLog.ERROR); - } - DateTime scadenza = rigaPost.InputUntil; - if (scadenza < DateTime.Now) - { - if (adminInput) - { - adminInput = false; - memLayer.ML.emptySessionVal("lblTitoloUI"); - memLayer.ML.emptySessionVal("lblMessUI"); - } - } - } - /// - /// controllo se ci sia qualcosa da mostrare... - /// - private void updateUI() - { - bool hasTitolo = memLayer.ML.isInSessionObject("lblTitoloUI"); - bool hasMess = memLayer.ML.isInSessionObject("lblMessUI"); - if (hasTitolo && hasMess) - { - showMess(memLayer.ML.StringSessionObj("lblTitoloUI"), memLayer.ML.StringSessionObj("lblMessUI")); - } - } - /// - /// restituisce una riga operatore data al matricola - /// - /// - /// - protected DS_applicazione.AnagraficaOperatoriRow getRigaOperatore(int MatrOper) - { - try - { - return DataLayer.obj.taOp.getByMatrOpr(MatrOper)[0]; - } - catch - { - logger.lg.scriviLog(string.Format("Codice matricola operatore non trovato! {0}", BarCode)); - return null; - } - } - - /// - /// popola le labels - /// - private void popolaLabels() - { - int odl = 0; - DateTime dataFrom = DateTime.Now; - DateTime dataTo = DateTime.Now; - // label ODL - try - { - DS_ProdTempi.ODLRow rigaOdl = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0]; - odl = rigaOdl.IdxODL; - dataFrom = rigaOdl.DataInizio; - lblOdl.Text = string.Format("ODL num: {0}, iniziato il {1:dd/MM/yy} alle {1:HH:mm}", odl, dataFrom); - } - catch - { - lblOdl.Text = "n/a"; - } - /************************************ - * data la postazione corrente decide cosa mostrare e come - ************************************/ - MapoDb.DS_ProdTempi.stp_repDonati_getDatiProdMacchinaRow rigaProd = DataLayer.obj.taDatiProdMacch.GetData(idxMacchina)[0]; - lblCodArticolo.Text = rigaProd.CodArticolo; - lblNumPzLanciati.Text = string.Format("{0} pz.", rigaProd.PezziLanciati); - lblNumPzConf.Text = string.Format("{0} pz.", rigaProd.PezziConf); - lblNumPzFatti.Text = string.Format("({0} pz.)", rigaProd.PezziProd); - - - /************************************ - * calcolo efficienza totale - * se il calcolo non è possibile mette n/a - ************************************/ - decimal tempoProd = rigaProd.TCAssegnato * rigaProd.PezziConf; - try - { - lblEfficienzaTot.Text = Convert.ToString(String.Format("{0:p2}", tempoProd / rigaProd.TempoOn / 100)); - } - catch - { - lblEfficienzaTot.Text = "n/a"; - } - // calcolo efficienza lavoro - se il calcolo non è possibile mette n/a - try - { - lblEfficienzaLavoro.Text = Convert.ToString(String.Format("{0:p2}", tempoProd / rigaProd.TempoAuto / 100)); - } - catch - { - lblEfficienzaLavoro.Text = "n/a"; - - } - // calcolo efficienza Teorica - se il calcolo non è possibile mette n/a - try - { - lblEfficienzaEff.Text = Convert.ToString(String.Format("{0:p2}", tempoProd / rigaProd.TempoRun / 100)); - } - catch - { - lblEfficienzaEff.Text = "n/a"; - } - - /************************************ - * imposto i TEMPI CICLO - ************************************/ - // riporto Tempo ciclo impostato - lblTcImpostato.Text = Convert.ToString(String.Format("{0:0.###}", rigaProd.TCAssegnato)); - // riporto Tempo ciclo medio - lblTcMedio.Text = Convert.ToString(String.Format("{0:0.###}", rigaProd.TCMedio)); - lblTcMedioRT.Text = Convert.ToString(String.Format("({0:0.###})", rigaProd.TCMedioRT)); - // riporto Tempo ciclo lavoro - lblTcLavoro.Text = Convert.ToString(String.Format("{0:0.###}", rigaProd.TCLav)); - lblTcLavoroRT.Text = Convert.ToString(String.Format("({0:0.###})", rigaProd.TCLavRT)); - // riporto Tempo ciclo effettivo/tecnico, come media dei 10 migliori delle ultime 8 ore - lblTcEffettivo.Text = Convert.ToString(String.Format("{0:0.###}", rigaProd.TCEff)); - lblTcEffettivoRT.Text = Convert.ToString(String.Format("({0:0.###})", rigaProd.TCEffRT)); - - /************************************ - * Sistemo efficienze RT da tempi ciclo - ************************************/ - try - { - lblEfficienzaTotRT.Text = Convert.ToString(String.Format("({0:p2})", rigaProd.TCAssegnato / rigaProd.TCMedioRT)); - } - catch - { - lblEfficienzaTotRT.Text = "n/a"; - } - // calcolo efficienza lavoro - se il calcolo non è possibile mette n/a - try - { - lblEfficienzaLavoroRT.Text = Convert.ToString(String.Format("({0:p2})", rigaProd.TCAssegnato / rigaProd.TCLavRT)); - } - catch - { - lblEfficienzaLavoroRT.Text = "n/a"; - - } - // calcolo efficienza Teorica - se il calcolo non è possibile mette n/a - try - { - lblEfficienzaEffRT.Text = Convert.ToString(String.Format("({0:p2})", rigaProd.TCAssegnato / rigaProd.TCEffRT)); - } - catch - { - lblEfficienzaEffRT.Text = "n/a"; - } - } - - /// - /// codice barcode - /// - public string BarCode - { - set - { - _bCode = value; - // eseguo codice... - decodeBCode(); - } - get - { - return _bCode; - } - } - /// - /// mostra il messaggio indicato - /// - /// - /// - protected void showMess(string titolo, string messaggio) - { - pnlMessaggi.Visible = true; - lblTitolo.Text = titolo; - lblMess.Text = messaggio; - } - /// - /// idxMacchina - /// - public string idxMacchina - { - get - { - return memLayer.ML.StringSessionObj("idxMacchinaUI"); - } - set - { - memLayer.ML.setSessionVal("idxMacchinaUI", value); - setMacchinaPostazione(); - } - } - /// - /// idxPostazione - /// - public string idxPostazione - { - get - { - return memLayer.ML.StringSessionObj("idxPostazioneUI"); - } - set - { - memLayer.ML.setSessionVal("idxPostazioneUI", value); - // calcolo la macchina... - setMacchinaPostazione(); - } - } - /// - /// aggiorna associazione codice macchina e postazione su DB - /// - private void setMacchinaPostazione() - { - // salvo associazione macchina / postazione se entrambe != "" - if (idxMacchina != "" && idxPostazione != "") - { - DataLayer.obj.taPostazioni.updateMacchina(idxPostazione, idxMacchina); - } - } - /// - /// assegna il tipo di barcode dalal stringa passata - /// - /// - private void assegnaTipoBarcode(out tipoBarcode _tipoBCode) - { - // leggo le conf di gestione del barcode - string prefDichProd = memLayer.ML.confReadString("prefDichProd"); - string prefDichFerm = memLayer.ML.confReadString("prefDichFerm"); - string prefDichOp = memLayer.ML.confReadString("prefDichOp"); - string prefDichCodArt = memLayer.ML.confReadString("prefDichCodArt"); - string prefDichAttrezzaggio = memLayer.ML.confReadString("prefDichAttrezzaggio"); - string prefModTurno = memLayer.ML.confReadString("prefModTurno"); - _tipoBCode = tipoBarcode.nd; - // prendo le prime 2 cifre del barcode x capirne la natura - string prefBarcode = BarCode.Substring(0, 2); - if (prefBarcode == prefDichProd) - { - _tipoBCode = tipoBarcode.confermaProduzione; - } - else if (prefBarcode == prefDichFerm) - { - _tipoBCode = tipoBarcode.dichiaraFermata; - } - else if (prefBarcode == prefDichOp) - { - _tipoBCode = tipoBarcode.matrOperatore; - } - else if (prefBarcode == prefDichCodArt) - { - _tipoBCode = tipoBarcode.codArticolo; - } - else if (prefBarcode == prefDichAttrezzaggio) - { - _tipoBCode = tipoBarcode.attrezzaggio; - } - else if (prefBarcode == prefModTurno) - { - _tipoBCode = tipoBarcode.modificaTurno; - } - } - - /// - /// esegue decodifica barcode - /// - private void decodeBCode() - { - // calcolo il tipo di barcode ricevuto - tipoBarcode _tipoBCode; - assegnaTipoBarcode(out _tipoBCode); - // in primis verifico se sia abilitato input alla postazione - if (adminInput) - { - // in base al tipo di barcode definisco il da farsi... - switch (_tipoBCode) - { - case tipoBarcode.nd: - // non faccio nulla - break; - case tipoBarcode.matrOperatore: - processaCartellinoOperatore(); - break; - case tipoBarcode.codArticolo: - // x ora non serve - break; - case tipoBarcode.attrezzaggio: - processaAttrezzaggio(); - break; - case tipoBarcode.confermaProduzione: - processaProduzione(); - break; - case tipoBarcode.dichiaraFermata: - processaDichiaraFermata(); - break; - case tipoBarcode.modificaTurno: - processaModificaTurno(); - break; - default: - break; - } - } - else // edit avanzato non permesso, possibile solo sparare barcode utente... - { - // controllo se sia un barcode utente... - if (_tipoBCode == tipoBarcode.matrOperatore) - { - processaCartellinoOperatore(); - } - else - { - // mostra warning xché interazione non permessa - salvaRicarica("Abilitazione richiesta!", "Codice non accettato: prima registrare barcode utente abilitato"); - } - } - - } - /// - /// chiama modifica stato turno - /// - private void processaModificaTurno() - { - string prefModTurno = memLayer.ML.confReadString("prefModTurno"); - // recupero dati evento... - int numTurno = 0; - try - { - numTurno = Convert.ToInt32(BarCode.Replace(prefModTurno, "")); - } - catch - { - logger.lg.scriviLog(string.Format("Barcode modifica turno non valido! {0}", BarCode)); - } - if (numTurno > 0) - { - DataLayer.obj.taTurniMacc.stp_turniMacchineUpdateTurno(idxMacchina, numTurno); - // ricarico! - salvaRicarica("Dichiarazione fermata", "Registrata modifica turno"); - } - else - { - salvaRicarica("Errore", string.Format("Codice modifica turno non valido! {0}", BarCode)); - } - } - /// - /// contiene in sessione i pezzi da confermare - /// - protected int prod2confirm - { - get - { - int answ = 0; - try - { - answ = memLayer.ML.IntSessionObj("prod2confirm"); - } - catch - { - answ = -1; - } - return answ; - } - set - { - memLayer.ML.setSessionVal("prod2confirm", value); - } - } - /// - /// processa barcode di dichiarazione e conferma produzione - /// - private void processaProduzione() - { - string prefDichProd = memLayer.ML.confReadString("prefDichProd"); - string MostraProd = memLayer.ML.confReadString("MostraProd"); - string ConfermaProd = memLayer.ML.confReadString("ConfermaProd"); - string AnnullaProd = memLayer.ML.confReadString("AnnullaProd"); - string AumentaProd = memLayer.ML.confReadString("AumentaProd"); - string DiminuisciProd = memLayer.ML.confReadString("DiminuisciProd"); - /* *********************************************** - * Processing Produzione - * *********************************************** - * - * regole: - * - serve x iniziare un mostra prod, che salva in sessione la produzione rilevata - * - è accettato, se in sessione c'è un dato di prod, la conferma - * - è accettato la cancellazione (svuota da sessione..) - * - è accettato, se in sessione c'è un dato di prod, aumentare o diminuire la produzione - */ - bool produzioneCaricata = memLayer.ML.isInSessionObject("prod2confirm"); - int variazione = 0; - if (!produzioneCaricata) // se non ho caricato produzione è ammesso solo il comando di caricamento produzione da sistema... - { - if (BarCode == MostraProd) - { - caricaProduzioneMacchina(); - } - else - { - // mostro warning - salvaRicarica("Errore codice produzione", "Deve prima essere richiesta la conferma di produzione per mostrare i dati di produzione e solo successivmaente si può confermare/annullare/modificare"); - } - } - else - { - if (BarCode == MostraProd) - { - caricaProduzioneMacchina(); - } - else if (BarCode == AnnullaProd) - { - memLayer.ML.emptySessionVal("prod2confirm"); - salvaRicarica("Annullata conferma produzione", "annullata operazione conferma di produzioone, prego ricominciare"); - } - else if (BarCode.Substring(0, 3) == AumentaProd) - { - variazione = Convert.ToInt32(BarCode.Replace(AumentaProd, "")); - prod2confirm += variazione; - salvaRicarica("Conferma produzione", string.Format("Pezzi prodotti da confermare: {0}, per il periodo {1:dd/MM/yy HH:mm:ss} --> {2:dd/MM/yy HH:mm:ss}", prod2confirm, DateTime.Now.AddDays(-1), DateTime.Now)); - } - else if (BarCode.Substring(0, 3) == DiminuisciProd) - { - variazione = Convert.ToInt32(BarCode.Replace(DiminuisciProd, "")); - prod2confirm -= variazione; - salvaRicarica("Conferma produzione", string.Format("Pezzi prodotti da confermare: {0}, per il periodo {1:dd/MM/yy HH:mm:ss} --> {2:dd/MM/yy HH:mm:ss}", prod2confirm, DateTime.Now.AddDays(-1), DateTime.Now)); - } - else if (BarCode == ConfermaProd) - { - confermaProduzioneSuDb(); - } - else - { - salvaRicarica("Errore!", string.Format("Codice produzione non riconosciuto: {0}", BarCode)); - } - } - } - /// - /// conferma al produzione sul db - /// - private void confermaProduzioneSuDb() - { - // carico i dati da confermare... - DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd; - rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina)[0]; - // carico i dati necessari x approvatgore ed ODL - int idxOdl = 0; // userò ODL del turno - DS_ProdTempi.ODLDataTable elencoOdlTurno; - int MatrAppr = 0; // leggo da postazioniMapo - try - { - idxOdl = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0].IdxODL; - } - catch - { - logger.lg.scriviLog(string.Format("Errore a recuperare ODL per la macchina {0}", idxMacchina), tipoLog.ERROR); - } - try - { - MatrAppr = DataLayer.obj.taPostazioni.getByIdxPostaz(idxPostazione)[0].MatrOperatore; - } - catch - { - logger.lg.scriviLog(string.Format("Errore a recuperare MatrApp per la postazione {0}", idxPostazione), tipoLog.ERROR); - } - // chiamo la stored - try - { - // ricavo i turni della macchina da anagrafica - // !!!FARE!!! da db incrociando dati da anagrafica... x ora calcolo con turno 8 h x 7 gg/week - int shiftTurno = 6; - int durataTurno = 8; - // calcolo quanti turni da approvare ci siano - int numTurni2appr = (int)Math.Floor(rigaProd.DataTo.Subtract(rigaProd.DataFrom).TotalHours / durataTurno); - // questa dataora rappresenta l'inizio del turno che man mano vado ad approvare - DateTime dataCurr = rigaProd.DataFrom; - turnoLavoro turnoCurr; - int pzProd = 0; - int idxStatoProd = 13; // hard coded!!! - // definisco intervallo date x fare query (inizialmente è turno - intervalloDate periodoOdl = new intervalloDate(); - intervalloDate periodoProd = new intervalloDate(); - // vado a ciclare da dataFrom a dataTo per ogni turno compreso fino all'ultimo turno intero - for (int i = 0; i < numTurni2appr; i++) - { - // calcolo il turno che comprende la data da approvare - turnoCurr = datario.mngr.getTurnoByDateTime(dataCurr, shiftTurno, durataTurno); - // recupero elenco ODL del turno (in modo che se ne ho + di 1 faccio + inserimenti produzione) - elencoOdlTurno = DataLayer.obj.taODL.getByMacchinaPeriodo(idxMacchina, turnoCurr.inizio, turnoCurr.fine); - // se ho almeno 1 ODL approvo... - foreach (DS_ProdTempi.ODLRow odl in elencoOdlTurno) - { - idxOdl = odl.IdxODL; - // calcolo periodo ODL - periodoOdl = datario.mngr.setIntervallo(odl.DataInizio, odl.DataFine); - // calcolo intersezione periodi: tra turno e validità ODL - periodoProd = datario.mngr.intersecaIntervalli(periodoOdl, turnoCurr.periodo); - // calcolo i pezzi da confermare x l'ODL in esame... ovvero imposto inizio/fine periodo da intersezione periodo ODL + turno - try - { - // approvando tanto la produzione - pzProd = DataLayer.obj.taPzProd2conf.getByMacchinaPeriodo(idxMacchina, periodoProd.inizio, periodoProd.fine)[0].pezziNonConfermati; - } - catch - { - pzProd = 0; - } - // carico i dati x Turno ed ODL - try - { - DataLayer.obj.taPzProd2conf.stp_DatiConf_conferma(idxOdl, idxMacchina, MatrAppr, turnoCurr.inizio, turnoCurr.fine, turnoCurr.TNum, idxStatoProd, pzProd); - } - catch - { - logger.lg.scriviLog(string.Format("Errore in INSERT dati x tab DatiConfermati: odl: {0}, idxMacchina: {1}, turno da {2} a {3}", idxOdl, idxMacchina, turnoCurr.inizio, turnoCurr.fine), tipoLog.ERROR); - } - } - // qui non ho + cambiato nulla per multi/ODL - try - { - // chiamo stored inserimento dati produzione per il turno - DataLayer.obj.taDatiProd.stp_DatiProd_insAllPeriodo(idxMacchina, turnoCurr.inizio, turnoCurr.fine, turnoCurr.inizio.Date, turnoCurr.TNum, MatrAppr); - } - catch - { - logger.lg.scriviLog(string.Format("Errore in insert x tab DatiProduzione per il turno: odl: {0}, idxMacchina: {1}, turno da {2} a {3}", idxOdl, idxMacchina, turnoCurr.inizio, turnoCurr.fine), tipoLog.ERROR); - } - dataCurr = dataCurr.AddHours(durataTurno); - } - // IN FINE confermo la produzione della DIFFERENZA tra quanto rilevato a sistema dai tempi ciclo rilevati e quanto dichiarato all'istante della dichiarazione - try - { - pzProd = DataLayer.obj.taPzProd2conf.getByMacchinaPeriodo(idxMacchina, rigaProd.DataFrom, rigaProd.DataTo)[0].pezziNonConfermati; - } - catch - { - pzProd = 0; - } - // confermo DELTA tab DatiConfermati - DataLayer.obj.taPzProd2conf.stp_DatiConf_conferma(idxOdl, idxMacchina, MatrAppr, DateTime.Now, DateTime.Now, 1, idxStatoProd, prod2confirm - pzProd); - // confermo DELTA tab DatiProduzione - ATTENZIONE NON METTO TEMPO NEGATIVO!!! - DataLayer.obj.taDatiProd.stp_DatiProd_insert(idxOdl, idxMacchina, MatrAppr, DateTime.Now, DateTime.Now, 1, prod2confirm - pzProd, 0, "T_CorrProd"); - } - catch - { - logger.lg.scriviLog("Errore nella chiamata a stored di conferma dati!", tipoLog.ERROR); - } - string messConferma = string.Format("Confermata la produzione per {0} pezzi!", prod2confirm); - memLayer.ML.emptySessionVal("prod2confirm"); - salvaRicarica("Confermata produzione", messConferma); - } - /// - /// carica da db la produzione x la macchina in oggetto - /// - private void caricaProduzioneMacchina() - { - DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd; - rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina)[0]; - try - { - prod2confirm = rigaProd.pezziNonConfermati; - } - catch - { - prod2confirm = 0; - logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}", idxMacchina), tipoLog.ERROR); - } - salvaRicarica("Conferma produzione", string.Format("Pezzi prodotti da confermare: {0}, per il periodo {1:dd/MM/yy HH:mm:ss} --> {2:dd/MM/yy HH:mm:ss}", rigaProd.pezziNonConfermati, rigaProd.DataFrom, rigaProd.DataTo)); - } - /// - /// effettua processing delel chiamate di attrezzaggio macchina - /// - private void processaAttrezzaggio() - { - string prefDichAttrezzaggio = memLayer.ML.confReadString("prefDichAttrezzaggio"); - string StartSetup = memLayer.ML.confReadString("StartSetup"); - string EndSetup = memLayer.ML.confReadString("EndSetup"); - string EndProd = memLayer.ML.confReadString("EndProd"); - // recupero dati evento attrezzaggio... - int idxEvento = 0; - try - { - // leggo 3-4 char che rappresenta evento (ignoro il resto che è codice ODL...) - idxEvento = Convert.ToInt32(BarCode.Substring(2, 2)); - } - catch - { - logger.lg.scriviLog(string.Format("Barcode attrezzaggio non valido! {0}", BarCode)); - } - // verifico che l'ODL sia attrezzabile - int idxODL = 0; - DS_ProdTempi.ODLRow rigaOdl; - try - { - idxODL = Convert.ToInt32(BarCode.Substring(4, BarCode.Length - 4)); - rigaOdl = DataLayer.obj.taODL.getByIdx(idxODL, false)[0]; - } - catch - { - logger.lg.scriviLog(string.Format("impossibile ricavare codice ODL per attrezzaggio! {0}", BarCode)); - } - // processo l'evento - if (idxEvento > 0) - { - DS_applicazione.AnagraficaEventiRow rigaEvento = DataLayer.obj.taAnagEventi.GetByIdx(idxEvento)[0]; - if (rigaEvento != null) - { - /* *********************************************** - * Processing ODL - * *********************************************** - * - * regole evento inizio setup: - * - se idxODL già usato --> errore esco - * - se idxODL ok chiudo eventuali ODL precedenti su stessa macchina e segno macchina+ dataora inizio - * - * regole evento fine prod: - * - se idxODL ok lo chiudo (dataora fine) - */ - - // controllo evento inizio attrezzaggio - if (BarCode.StartsWith(StartSetup)) - { - // cerco di nuovo ODL tra i NON impiegati - int odlNonImpiegati = DataLayer.obj.taODL.getByIdx(idxODL, true).Rows.Count; - if (odlNonImpiegati > 0) // effettuo "consumo" ODL - { - DataLayer.obj.taODL.inizioSetup(idxODL, DataLayer.MatrOpr, idxMacchina, DataLayer.obj.taODL.getByIdx(idxODL, true)[0].TCAssegnato, ""); - } - else // ODL già impiegato - { - salvaRicarica("Errore ODL", "l'ODL indicato è stato già lanciato, utilizzare un ODL nuovo"); - } - } - else if (BarCode.StartsWith(EndProd)) // evento fine prod - { - // controllo se verificare codice odl da barcode... o se c'è idxOdl zero = manca... - if (!memLayer.ML.confReadBool("chkIdxOdlEndProd") || idxODL == 0) - { - try - { - // leggo idxOdl da ultimo odl attivo x macchina - idxODL = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0].IdxODL; - } - catch - { - logger.lg.scriviLog(string.Format("Errore recupero odl per la macchina {0}", idxMacchina), tipoLog.ERROR); - } - } - // chiudo ODL corrente - DataLayer.obj.taODL.fineProd(idxODL, idxMacchina); - } - DS_applicazione.StatoMacchineRow rigaStato = DataLayer.obj.taStatoMacchine.GetDataByIdxMacchina(idxMacchina)[0]; - // ricavo codice articolo... - string CodArticolo = DataLayer.obj.taODL.getByIdx(idxODL, false)[0].CodArticolo; - // processo evento... - controllerMapo.scriviRigaEventoBarcode(idxMacchina, idxEvento, CodArticolo, "", rigaStato.MatrOpr, rigaStato.pallet); - // ricarico a seconda del tipo di codice - if (BarCode.StartsWith(StartSetup)) - { - salvaRicarica("Dichiarazione fermata", String.Format("Registrata dichiarazione inizio attrezzaggio per ODL {0}", idxODL)); - } - else if (BarCode.StartsWith(EndSetup)) - { - salvaRicarica("Fine attrezzaggio", String.Format("Registrata fine attrezzaggio per ODL {0}", idxODL)); - } - else if (BarCode.StartsWith(EndProd)) - { - salvaRicarica("Fine produzione", String.Format("Registrata fine produzione per ODL {0}", idxODL)); - - } - - } - else - { - salvaRicarica("Errore", string.Format("Codice attrezzaggio non valido! {0}", BarCode)); - } - } - } - /// - /// effettua processing cartellino fermate - /// - private void processaDichiaraFermata() - { - string prefDichFerm = memLayer.ML.confReadString("prefDichFerm"); - // recupero dati evento... - int idxEvento = 0; - try - { - idxEvento = Convert.ToInt32(BarCode.Replace(prefDichFerm, "")); - } - catch - { - logger.lg.scriviLog(string.Format("Barcode fermata non valido! {0}", BarCode)); - } - if (idxEvento > 0) - { - DS_applicazione.AnagraficaEventiRow rigaEvento = DataLayer.obj.taAnagEventi.GetByIdx(idxEvento)[0]; - if (rigaEvento != null) - { - DS_applicazione.StatoMacchineRow rigaStato = DataLayer.obj.taStatoMacchine.GetDataByIdxMacchina(idxMacchina)[0]; - // processo evento... - controllerMapo.scriviRigaEventoBarcode(idxMacchina, idxEvento, rigaStato.CodArticolo, "", rigaStato.MatrOpr, rigaStato.pallet); - // ricarico! - salvaRicarica("Dichiarazione fermata", "Registrata dichiarazione fermata"); - } - else - { - salvaRicarica("Errore", string.Format("Codice evento non valido! {0}", BarCode)); - } - } - } - /// - /// effettua processing cartellino operatore - /// - /// - private void processaCartellinoOperatore() - { - string prefDichOp = memLayer.ML.confReadString("prefDichOp"); - // recupero dati operatore... - int matrOpr = 0; - try - { - matrOpr = Convert.ToInt32(BarCode.Replace(prefDichOp, "")); - } - catch - { - logger.lg.scriviLog(string.Format("Barcode operatore non valido! {0}", BarCode)); - } - if (matrOpr > 0) - { - DS_applicazione.AnagraficaOperatoriRow rigaOperatore = getRigaOperatore(matrOpr); - if (rigaOperatore != null) - { - if (rigaOperatore.isAdmin) - // se è admin apro finestra modifica - { - int minutiUpdateAdmin = memLayer.ML.confReadInt("minutiUpdateAdmin"); - DataLayer.obj.taPostazioni.updateOperatoreAdmin(idxPostazione, matrOpr, minutiUpdateAdmin); - // salvo che sono in stato edit admin - adminInput = true; - // aggiorno pagina - salvaRicarica(string.Format("Benvenuto {0} {1}!", rigaOperatore.Nome, rigaOperatore.Cognome), string.Format("potrai effettuare operazioni amministrative fino alle {0:HH:mm:ss}", DateTime.Now.AddMinutes(minutiUpdateAdmin))); - } - else - // se è user std sostituisco utente corrente su macchina... - { - DataLayer.obj.taStatoMacchine.updateOper(idxMacchina, matrOpr); - salvaRicarica("Cambio Operatore", "effettuato cambio operatore"); - } - } - else - { - salvaRicarica("Errore", string.Format("Matricola operatore non valida! {0}", BarCode)); - } - } - } - /// - /// salva in sessione cosa mostrare x messaggio operatore e ricarica - /// - /// - /// - protected void salvaRicarica(string titolo, string mess) - { - memLayer.ML.setSessionVal("lblTitoloUI", titolo); - memLayer.ML.setSessionVal("lblMessUI", mess); - // rimando a pagina attuale x evitare che "resti aperta " per troppo la finestra... - Response.Redirect(string.Format("~/UI.aspx?idxPostazione={0}&idxMacchina={1}", idxPostazione, idxMacchina)); - } - /// - /// fornisce classe CSS x colorare il turno secondo apertura o meno - /// - /// - /// - public string coloreDaTurno(object turno) - { - string answ = "sGr"; - bool aperto = false; - try - { - aperto = Convert.ToBoolean(turno); - } - catch - { } - if (aperto) - { - answ = "sVe"; - } - - return answ; - } - } -} \ No newline at end of file diff --git a/MP-Site/WebUserControls/mod_UI.ascx.designer.cs b/MP-Site/WebUserControls/mod_UI.ascx.designer.cs deleted file mode 100644 index 396fa9f4..00000000 --- a/MP-Site/WebUserControls/mod_UI.ascx.designer.cs +++ /dev/null @@ -1,250 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MoonPro.WebUserControls -{ - - - public partial class mod_UI { - - /// - /// pnlMessaggi control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlMessaggi; - - /// - /// lblTitolo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTitolo; - - /// - /// lblMess control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMess; - - /// - /// lblODLCorrente control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblODLCorrente; - - /// - /// pnlInterazione control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlInterazione; - - /// - /// pnlProduzione control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlProduzione; - - /// - /// dtView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DetailsView dtView; - - /// - /// odsTurni control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ObjectDataSource odsTurni; - - /// - /// lblOdl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblOdl; - - /// - /// lblCodArticolo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblCodArticolo; - - /// - /// lblNumPzLanciati control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblNumPzLanciati; - - /// - /// lblNumPzConf control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblNumPzConf; - - /// - /// lblNumPzFatti control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblNumPzFatti; - - /// - /// lblEfficienzaTot control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaTot; - - /// - /// lblEfficienzaTotRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaTotRT; - - /// - /// lblEfficienzaLavoro control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaLavoro; - - /// - /// lblEfficienzaLavoroRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaLavoroRT; - - /// - /// lblEfficienzaEff control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaEff; - - /// - /// lblEfficienzaEffRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEfficienzaEffRT; - - /// - /// lblTcMedio control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcMedio; - - /// - /// lblTcMedioRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcMedioRT; - - /// - /// lblTcLavoro control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcLavoro; - - /// - /// lblTcLavoroRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcLavoroRT; - - /// - /// lblTcEffettivo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcEffettivo; - - /// - /// lblTcEffettivoRT control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcEffettivoRT; - - /// - /// lblTcImpostato control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTcImpostato; - } -}