diff --git a/.vs/GMW.sqlite b/.vs/GMW.sqlite index 7782b349..fdb9af60 100644 Binary files a/.vs/GMW.sqlite and b/.vs/GMW.sqlite differ diff --git a/GMW/GMW.csproj b/GMW/GMW.csproj index 124ca868..3dce4534 100644 --- a/GMW/GMW.csproj +++ b/GMW/GMW.csproj @@ -580,6 +580,7 @@ + @@ -1850,6 +1851,13 @@ mod_PostFinMultOUT.ascx + + mod_PostFin_DT.ascx + ASPXCodeBehind + + + mod_PostFin_DT.ascx + mod_PostFusioni.ascx ASPXCodeBehind diff --git a/GMW/PostFin_DT.aspx b/GMW/PostFin_DT.aspx index 56786549..5bc94515 100644 --- a/GMW/PostFin_DT.aspx +++ b/GMW/PostFin_DT.aspx @@ -2,14 +2,15 @@ <%@ Register Src="WebUserControls/mod_selLineaNtDt.ascx" TagName="mod_selLineaNtDt" TagPrefix="uc1" %> <%@ Register Src="WebUserControls/mod_storicoAzioniOperatore.ascx" TagName="mod_storicoAzioniOperatore" TagPrefix="uc2" %> -<%@ Register Src="WebUserControls/mod_PostRX_DT.ascx" TagName="mod_PostRX_DT" TagPrefix="uc3" %> +<%@ Register Src="WebUserControls/mod_PostFin_DT.ascx" TagPrefix="uc1" TagName="mod_PostFin_DT" %> + - +
@@ -31,7 +32,7 @@
- +
diff --git a/GMW/PostFin_DT.aspx.cs b/GMW/PostFin_DT.aspx.cs index a75bf914..4cec21c7 100644 --- a/GMW/PostFin_DT.aspx.cs +++ b/GMW/PostFin_DT.aspx.cs @@ -24,14 +24,14 @@ namespace GMW // fix css... Postazione.CssClass = "stileAttesa"; // imposto pos abilitata x cancellazione - mod_storicoAzioniOperatore1.IdxPosizione2del = memLayer.ML.cdvi("IdxPosizioneRX"); + mod_storicoAzioniOperatore1.IdxPosizione2del = memLayer.ML.cdvi("IdxPosizioneFiniti"); } // update vari... doUpdate(); mod_storicoAzioniOperatore1.eh_stampa += new EventHandler(mod_storicoAzioniOperatore1_eh_stampa); - mod_PostRX_DT1.doUpdate(); - mod_PostRX_DT1.eh_reqUpdate += mod_PostRX_DT1_eh_reqUpdate; + mod_PostFin_DT.doUpdate(); + mod_PostFin_DT.eh_reqUpdate += mod_PostRX_DT1_eh_reqUpdate; mod_selLineaNtDt1.eh_lineSelected += mod_selLineaNtDt1_eh_doRefresh; mod_selLineaNtDt1.eh_showHideStorico += mod_selLineaNtDt1_eh_showHideStorico; } @@ -52,7 +52,7 @@ namespace GMW private void mod_selLineaNtDt1_eh_doRefresh(object sender, EventArgs e) { doUpdate(); - mod_PostRX_DT1.doUpdate(); + mod_PostFin_DT.doUpdate(); } /// /// richiesta update del controllo SAO @@ -79,7 +79,7 @@ namespace GMW /// void mod_storicoAzioniOperatore1_eh_stampa(object sender, EventArgs e) { - mod_PostRX_DT1.ristampa(); + mod_PostFin_DT.ristampa(); } /// /// sistemo visualizzazione pannelli @@ -89,7 +89,7 @@ namespace GMW // default: moduli NON visibili SE non ho linea indicata.. bool enableBtn = false; if (Postazione.currCodCella != "") enableBtn = true; - mod_PostRX_DT1.Visible = enableBtn; + mod_PostFin_DT.Visible = enableBtn; fixStorico(); } /// diff --git a/GMW/PostFin_DT.aspx.designer.cs b/GMW/PostFin_DT.aspx.designer.cs index 2137c197..4d94a659 100644 --- a/GMW/PostFin_DT.aspx.designer.cs +++ b/GMW/PostFin_DT.aspx.designer.cs @@ -67,12 +67,12 @@ namespace GMW { protected global::System.Web.UI.WebControls.Label lblWarning; /// - /// Controllo mod_PostRX_DT1. + /// Controllo mod_PostFin_DT. /// /// /// Campo generato automaticamente. /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// - protected global::GMW.WebUserControls.mod_PostRX_DT mod_PostRX_DT1; + protected global::GMW.WebUserControls.mod_PostFin_DT mod_PostFin_DT; } } diff --git a/GMW/WebUserControls/mod_PostFin_DT.ascx b/GMW/WebUserControls/mod_PostFin_DT.ascx new file mode 100644 index 00000000..cca5f643 --- /dev/null +++ b/GMW/WebUserControls/mod_PostFin_DT.ascx @@ -0,0 +1,141 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_PostFin_DT.ascx.cs" Inherits="GMW.WebUserControls.mod_PostFin_DT" %> +<%if (false) + { %> + + +<%} %> + +

ricopiare da PostLiquidi_DT!!!

+ +
+
+
+ devo mostrare UDC + trattamento caricati (1 x particolare... uno nuovo consuma il vecchio) + modalità rimozione DTX come PostLiquidi_DT - vedi PostLiquidi_DT + comportamento TK x POST_Finiti +
+
+ <%: traduci("ParticolariCaricati") %> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ <%: traduci("DataFusione") %> +
+
+ +
+ +
+
+
+
+
+
+ +
+
+ +
+ +
+
+
+
+
+ <%: traduci("lblDataMatrix") %> +
+ +
+
+
+
+ <%: traduci("Note") %> +
+
+ +
+
+ <%: traduci("lbtGeneraAl") %> + <%: traduci("lbtGeneraUDC") %> +
+
+
+
+
+
+ destinazione UDC (da datamatrix caricati, con controllo che ci siano trattamenti compatibili a sx... - vedi PostLiquidi_DT +
+
+ <%: traduci("lblQtaPart") %> +
+
+ <%--disabilitati in maschera dtx--%> + + <%: traduci("addUDC") %> +
+
+
+
+ <%: traduci("lblCesta") %> +
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/GMW/WebUserControls/mod_PostFin_DT.ascx.cs b/GMW/WebUserControls/mod_PostFin_DT.ascx.cs new file mode 100644 index 00000000..8d66282d --- /dev/null +++ b/GMW/WebUserControls/mod_PostFin_DT.ascx.cs @@ -0,0 +1,968 @@ +using GMW_data; +using SteamWare; +using System; +using System.Globalization; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace GMW.WebUserControls +{ + public partial class mod_PostFin_DT : System.Web.UI.UserControl + { + /// + /// flusso associato (hard coded) a RX + /// + protected string flusso = "RX"; + /// + /// stato associato (hard coded) a Controllato RX + /// + protected string statoUDC = "ContrRx"; + /// + /// codice evento dell'UDC che si crea + /// + protected string codEventoUdc = "UDC_RX_DT"; + public event EventHandler eh_reqUpdate; + /// + /// stringa UID univoca + /// + public string uid + { + get + { + return this.UniqueID.Replace("$", "_").Replace("-", "_"); + } + } + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + currParticolare = ""; + lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus); + lblLinFus.Text = lineaFus; + Postazione.messaggiText = ""; + Postazione.warningText = ""; + fixCella(); + traduciObj(); + } + doChecks(); + } + /// + /// qta pezzi x UDC + /// + public int qta + { + get + { + int qta = 0; + try + { + qta = Convert.ToInt32(txtQta.Text.Trim()); + } + catch + { } + return qta; + } + set + { + txtQta.Text = value.ToString(); + } + } + /// + /// data fusione impostata SALVATA SU DB... + /// + public DateTime dataFus + { + get + { + DateTime answ = Convert.ToDateTime("1900-01-01"); + try + { + + answ = Convert.ToDateTime(utils.obj.RTVal(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea)); + } + catch + { } + return answ; + } + set + { + utils.obj.taRTPV.upsert(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea, string.Format("{0:yyyy/MM/dd HH:mm}", value)); + lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", value); + } + } + /// + /// LINEA fusione impostata SALVATA SU DB... + /// + public string lineaFus + { + get + { + string answ = ""; + try + { + + answ = utils.obj.RTVal(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea); + } + catch + { } + //2016.01.25 se vuoto metto ND!!! + if (answ == "") + { + answ = "ND"; + } + return answ; + } + set + { + utils.obj.taRTPV.upsert(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea, value); + lblLinFus.Text = value; + } + } + /// + /// aggiorna visualizzazioen dati particolare + /// + private void updatePart() + { + if (currParticolare != "") + { + lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), 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 = ""; + } + } + /// + /// verifica se si debab mostrare un campo ricerca UDC attivo... + /// + private void fixCella() + { + lblIdxCella.Text = Postazione.currIdxCella.ToString(); + } + /// + /// richiesta (ri)stampa UDC + /// + /// + /// + public void ristampa() + { + MagClass.magazzino.stampaAL(udcReq, Postazione.printer, Request.UserHostName); + // registro ri-stampa UDC + MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, "", "creaAL", "Ri-Stampato AL Rx NT"); + } + /// + /// udc da stampare + /// + protected string udcReq + { + get + { + return memLayer.ML.StringSessionObj("udcSelSAO"); + } + } + /// + /// effettua controlli visibilità + /// + private void doChecks() + { + checkBarcode(); + } + /// + /// sistemo labels oggetti + /// + private void traduciObj() + { + + } + /// + /// wrapper traduzione + /// + /// + /// + public string traduci(object lemma) + { + return user_std.UtSn.Traduci(lemma.ToString()); + } + /// + /// indica se i caratteri vadano forzati a maiuscoli + /// + public bool forceUppercase + { + get + { + return memLayer.ML.confReadBool("forceUppercase"); + } + } + /// + /// Formato Datamatrix della linea selezionata + /// + protected string FormatoDtmxLinea + { + get + { + string answ = ""; + try + { + answ = MagClass.magazzino.taAL.getByKey(Postazione.currCodLinea)[0].FormatoDtmx; + } + catch + { } + return answ; + } + } + /// + /// Formato Datamatrix dell'ultimo barcode letto + /// + protected string FormatoDtmxBarcode + { + get + { + string answ = ""; + try + { + answ = DataMatrix.mgr.taVerifica.GetData(barcodeIn)[0].FormatoDtmx; + } + catch + { } + return answ; + } + } + /// + /// codice particolare da datamatrix + /// + /// bollean: + /// true = utilizza lookUp su tabella dati acquisiti + /// false = prova a decodificare (da formato Dtmx linea) + /// + protected string partByDtmx(bool byTable) + { + string answ = ""; + if (byTable) + { + try + { + answ = DataMatrix.mgr.taDtxAcquisiti.getByKey(barcodeIn)[0].Particolare; // Decode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare; + } + catch + { + answ = DataMatrix.mgr.taDecode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare; + } + } + else + { + answ = DataMatrix.mgr.taDecode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare; + } + return answ; + } + /// + /// valore barcode + /// + public string barcodeIn + { + get + { + return txtBarcode.Text.Trim(); + } + set + { + txtBarcode.Text = value; + } + } + /// + /// controlla se ci sia un barcode + /// + private void checkBarcode() + { + bool okDTL = false; + if (barcodeIn != "") + { + Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn); + switch (MagClass.tipoBCode_L5(barcodeIn)) + { + case tipoCodiceBarcode.DateTime: + okDTL = getDateTimeLine(barcodeIn, false); + if (okDTL) + { + Postazione.messaggiText = traduci("SetDataFus"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + } + else + { + Postazione.messaggiText = traduci("ERR-BCD-004"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoKo"; + } + break; + case tipoCodiceBarcode.DateTimeLine: + okDTL = getDateTimeLine(barcodeIn, true); + if (okDTL) + { + Postazione.messaggiText = traduci("SetDataFus"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + } + else + { + Postazione.messaggiText = traduci("ERR-BCD-004"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoKo"; + } + break; + case tipoCodiceBarcode.Particolare: + // imposto il particolare corrente + currParticolare = barcodeIn; + // controllo esista il particolare scansionato + if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0) + { + currParticolare = ""; + Postazione.messaggiText = traduci("partNotFound"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + Postazione.messaggiText = traduci("partSelected"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + } + // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto... + if (pezziUdc > 0) + { + qta = pezziUdc; + } + else // rimette default + { + qta = memLayer.ML.cdvi("QtaImballoRX"); + } + break; + case tipoCodiceBarcode.DataMatrixTrovato: + // controllo che il DTX non sia già assegnato... + if (DataMatrix.mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0) + { + // vers 2.9 + // controllo formato datamatrix sia impostato sulla linea (altrimenti errore linea "non battezzata") + if (FormatoDtmxLinea == "") + { + // errore poiché non è stato non specificato tipo Dtmx assegnato alla linea! + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("ERR-DTX-013"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + // verifico formato datamatrix letto sia quello della linea... + if (FormatoDtmxBarcode != FormatoDtmxLinea) + { + // errore corrispondenza formato Dtmx + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("ERR-DTX-014"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + // controllo esito marcatura... + bool marcaturaOk = false; + string formatiSbloccati = memLayer.ML.cdv(string.Format("sbloccoKO#{0}", user_std.pagCorrente)); // sbloccoKO#PostRX_DT + // verifico da conf SE il formato ha controllo KO sbloccato (default: KO BLOCCATI!!!) in tal caso è già OK!!! ATTENZIONE CERCA #codice# + if (formatiSbloccati.IndexOf("#" + FormatoDtmxLinea + "#") > 0) + { + marcaturaOk = true; + } + if (!marcaturaOk) + { + // recupero elenco datamatrix + DS_DataMatrix.v_ElencoDmtxDataTable tabDmtx = DataMatrix.mgr.taVED.getByKey(barcodeIn); + if (tabDmtx.Rows.Count > 0) + { + // verifica esitoMarcatura OK + marcaturaOk = (tabDmtx[0].EsitoMarcatura == "OK"); + } + } + + // verifico se datamatrix SIA KO (marcatura NON OK...) + if (!marcaturaOk) + { + // errore corrispondenza formato Dtmx + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("ERR-DTX-012"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + + // datamatrix ok: setto css e labels + Postazione.messaggiText = traduci("partSelected"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + // controllo il particolare da Dtx + check capienza celle + if (Postazione.currCodCella != "") + { + // calcolo particolare! + try + { + // vers 2.9 modifica per multi-datamatrix + currParticolare = partByDtmx(true); + //currParticolare = DataMatrix.mgr.taDecode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare; + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in decodifica particolare da DataMatrix:{0}dtx:{1}{0}Formato Linea:{2}{0}Eccezione:{0}{3}", Environment.NewLine, barcodeIn, exc), tipoLog.EXCEPTION); + currParticolare = ""; + } + if (currParticolare != "") + { + // 2016.01.25 aggiunta lettura codice x data-ora + linea fusione + // controllo per recuperare da datamatrix i dati di codice linea e data fusione + DS_DataMatrix.v_ElencoDmtxDataTable tabDmtx = DataMatrix.mgr.taVED.getByKey(barcodeIn); + if (tabDmtx.Rows.Count > 0) + { + if (tabDmtx[0].EtichettaFusione != "") + { + try + { + // imposto dataOra e linea fusione + okDTL = getDateTimeLine(tabDmtx[0].EtichettaFusione, true); + if (okDTL) + { + Postazione.warningText = traduci("SetDataFus"); + } + } + catch + { } + } + } + + // genera eventuale UDC del particolare su cella/posizione corrente + qta = 1; // tanto poi si ricalcola... + checkCreaUDC(); + // verifico se devo fare gestione con intervallo dtx... da tab config DB) + if (memLayer.ML.configDbVal("CreaDtxByInt") == "1") + //if (utils.obj.configDbVal("CreaDtxByInt") == "1") + { + // ora chiamo la stored che fa il check x tutti i particolari nell'intervallo dei Dtx associati alla cella e (se almeno 2) nel caso crea UDC + checkIntervalloDtx(); + } + /*------------------------------------------------------------------------------------------------- + * chiamo la stored che in blocco + * - associa Dtx a UDC + * - fa controllo, se ho almeno 2 Dtx ok associo tutti i Dtx compresi nell'intervallo min-MAX + *-------------------------------------------------------------------------------------------------- + */ + DataMatrix.mgr.taDtx2UDC.RxSetDtx2Udc(barcodeIn, MagClass.magazzino.CodSoggCurrUser, statoUDC, memLayer.ML.cdvi("IdxPosizioneRxTemp"), Postazione.currIdxCella); + + // 2017.07.22 svuoto barcodeIn.. + barcodeIn = ""; + } + } + } + } + } + } + else + { + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("DtxGiaAssegnato"); + Postazione.CssClass = "stileComandoKo"; + } + break; + case tipoCodiceBarcode.DataMatrixDecodificato: + // SEGNALO che ho trovato un partnumber che è un possibile datamatrix, ma che non è nell'elenco dei datamatrix acquisiti... + Postazione.warningText = traduci("partNumFoundNoDtx"); + Postazione.CssClass = "stileComandoWarn"; + // faccio le verifiche... verifico formato datamatrix sia COMPATIBILE con formato datamatrix della linea corrente... + if (FormatoDtmxBarcode != FormatoDtmxLinea) + { + // errore corrispondenza formato Dtmx + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("ERR-DTX-014"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + // se da web.config permesso il "force" di acquisizione + if (!memLayer.ML.confReadBool("enableDtxNotAcq")) + { + //errore gestione dmtx non acquisizione NON E' permessa + Postazione.messaggiText = barcodeIn; + Postazione.warningText = traduci("ERR-DTX-015"); + Postazione.CssClass = "stileComandoKo"; + } + else + { + // datamatrix ok: setto css e labels + Postazione.messaggiText = traduci("partSelected"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + // controllo il particolare da Dtx + check capienza celle + if (Postazione.currCodCella != "") + { + // calcolo particolare! + try + { + // vers 2.9 modifica per multi-datamatrix + currParticolare = partByDtmx(false); + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in decodifica particolare da DataMatrix:{0}dtx:{1}{0}Formato Linea:{2}{0}Eccezione:{0}{3}", Environment.NewLine, barcodeIn, exc), tipoLog.EXCEPTION); + currParticolare = ""; + } + if (currParticolare != "") + { + // genera eventuale UDC del particolare su cella/posizione corrente + qta = 1; // tanto poi si ricalcola... + checkCreaUDC(); + /*------------------------------------------------------------------------------------------------- + * chiamo la stored che in blocco + * - associa Dtx a UDC + * - fa controllo, se ho almeno 2 Dtx ok associo tutti i Dtx compresi nell'intervallo min-MAX + *-------------------------------------------------------------------------------------------------- + */ + DataMatrix.mgr.taDtx2UDC.RxSetDtx2Udc(barcodeIn, MagClass.magazzino.CodSoggCurrUser, statoUDC, memLayer.ML.cdvi("IdxPosizioneRxTemp"), Postazione.currIdxCella); + } + } + } + } + break; + default: + Postazione.warningText = traduci("ERR-UNK-001"); + Postazione.CssClass = "stileComandoND"; + break; + } + barcodeIn = ""; + } + else + { + Postazione.messaggiText = traduci("AttesaBCode"); + Postazione.CssClass = "stileAttesa"; + } + doUpdate(); + } + /// + /// recupera da barcode dataOra e linea fusione (SE presenti) + /// + /// valore x decodificare dataora - linea + /// SE si debba cercare ANCHE linea... + /// + private bool getDateTimeLine(string val2decode, bool readline) + { + bool okData = false; + bool okLinea = false; + DateTime oldDataFus = new DateTime(1900, 1, 1); + // imposto NUOVA dataora fusione... + string newData = ""; + string newLinea = ""; + // tento di recuperare e verifico validità dei 2 valori separatamente... + try + { + newData = val2decode.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(0, 10); + if (newData != "") + { + dataFus = DateTime.ParseExact(newData, "yyMMddHHmm", CultureInfo.InvariantCulture); + okData = true; + } + } + catch + { + dataFus = oldDataFus; + } + if (readline) + { + if (okData) + { + try + { + newLinea = val2decode.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(10, val2decode.Length - 10 - memLayer.ML.AppConf["prefDateTime"].Length); + if ((newLinea != "") && (DataProxy.obj.taElPost.getByCod(newLinea).Rows.Count > 0)) + { + lineaFus = newLinea; + okLinea = true; + } + else + { + lineaFus = ""; + dataFus = oldDataFus; + } + } + catch + { + lineaFus = ""; + dataFus = oldDataFus; + } + } + else + { + lineaFus = ""; + } + } + else + { + okLinea = true; + } + return okData && okLinea; + } + /// + /// aggiorna tabella + focus a barcode + /// + public void doUpdate() + { + fixCella(); + grView.DataBind(); + // fix dataFus + lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus); + lblLinFus.Text = lineaFus; + // aggiorno le qta! + qta = pezziUdc; + // update particolare + updatePart(); + // raise dell'evento + if (eh_reqUpdate != null) + { + eh_reqUpdate(this, new EventArgs()); + } + verificaBtnStampa(); + txtBarcode.Focus(); + } + /// + /// effettua reset dati + /// + private void doResetData() + { + // resetto i dati QtaTot e particolare... + doChecks(); + } + /// + /// indica il codice articolo correntemente selezionato + /// + protected string currParticolare + { + get + { + return memLayer.ML.StringSessionObj(string.Format("currParticolare_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("currParticolare_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel")); + } + } + /// + /// num pezzi dell'intero AL (temporaneo) + /// + public int pezziUdc + { + get + { + int answ = 0; + try + { + DS_magazzino.v_UdcDetailDataTable tabUdc = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(Convert.ToInt32(lblIdxCella.Text)); + if (tabUdc.Rows.Count > 0) + { + answ = Convert.ToInt32(float.Parse(tabUdc.Compute("Sum(Qta)", "").ToString())); + } + } + catch (Exception exc) + { + if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION); + answ = 0; + } + return answ; + } + } + /// + /// traduce gli header delle colonne + /// + /// + /// + 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} / 6", totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// creo il nuovo UDC da particolare corrente! + /// + /// + /// + protected void lbtAddUdc_Click(object sender, EventArgs e) + { + // controlli preliminari + if (Postazione.currCodCella != "") + { + if (currParticolare != "") + { + if (qta > 0) + { + checkCreaUDC(); + } + else + { + Postazione.warningText = traduci("ErroreNoQta"); + Postazione.CssClass = "stileComandoKo"; + } + } + else + { + Postazione.warningText = traduci("ErroreNoPart"); + Postazione.CssClass = "stileComandoKo"; + } + } + else + { + Postazione.warningText = traduci("ErroreNoSelLinea"); + Postazione.CssClass = "stileComandoKo"; + } + doUpdate(); + } + + /// + /// verifica tutti i DTX associati e se almeno 2 verifica ci siano UDC x tutti i particolari definiti nell'intervallo... + /// + /// + private void checkIntervalloDtx() + { + // recupero elenco intervallo e se ho almeno 2 particolari faccio check... + DS_DataMatrix.stp_conteggioDtxDataTable tabConteggi = DataMatrix.mgr.taConteggio.getByCodCella(Postazione.currCodCella); + if (tabConteggi.Rows.Count > 1) + { + // salvo particoalre x riassegnarlo alla fine... + string partSel = currParticolare; + // per ogni cella + foreach (DS_DataMatrix.stp_conteggioDtxRow riga in tabConteggi) + { + // imposto particolare corrente + currParticolare = riga.Particolare; + // faccio check... + checkCreaUDC(); + } + currParticolare = partSel; + } + } + /// + /// crea eventualmente UDC per particolare + /// + /// + /// + private void checkCreaUDC() + { + string newUdcChild = ""; + string noteTrim = ""; + DateTime adesso = DateTime.Now; + // verifico se ho già quel particolare tra quelli inseriti in linea... + try + { + newUdcChild = DataProxy.obj.taCartellini.getByParticolareIdxPosIdxCella(currParticolare, memLayer.ML.cdvi("IdxPosizioneRxTemp"), Postazione.currIdxCella)[0].UDC; + } + catch + { + newUdcChild = ""; + } + if (newUdcChild == "") + { + // controllo NON ci siano troppi UDC in posizione... da capienza ed assegnati + DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga; + bool piena = false; + try + { + riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0]; + if (riga.UdcAssegnati >= riga.Capienza) piena = true; + } + catch + { + } + if (!piena) + { + try + { + // forzo qta a 0 x generare nuovo UDC + qta = 0; + // creo nuovo UDC RX + newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoRX"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneRxTemp"), "IdxPosizioneRxTemp", codEventoUdc, noteTrim, "", adesso.Year, Request.UserHostName); + + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in creazione UDC temp RX: {0}{1}", Environment.NewLine, exc)); + } + } + else + { + Postazione.warningText = traduci("ErroreAL-Full"); + doUpdate(); + } + } + if (newUdcChild != "") + { + // lo posiziono nella cella corrente... + MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), newUdcChild, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName); + Postazione.CssClass = "stileAttesa"; + Postazione.warningText = ""; + Postazione.messaggiText = traduci("partAdded"); + + // 2014.07.10 aggiungo attributo della data di fusione... + MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "DF", string.Format("{0:yyyy/MM/dd HH:mm}", dataFus), adesso, MagClass.magazzino.CodSoggCurrUser); + + // 2015.06.03 aggiunto attributo linea fusione! + MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "LF", string.Format("{1} - {0:yy/MM/dd HH:mm}", dataFus, lineaFus), adesso, MagClass.magazzino.CodSoggCurrUser); + + currParticolare = ""; + doUpdate(); + } + } + /// + /// evento selezione: ricarico dati! + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // ricarico dati dell'UDC come particolare e quantità... + string UDC = grView.SelectedDataKey["UDC"].ToString(); + if (MagClass.magazzino.checkUDC(UDC)) + { + currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Particolare; + } + Postazione.messaggiText = traduci("partSelected"); + Postazione.warningText = ""; + Postazione.CssClass = "stileComandoOk"; + doUpdate(); + } + /// + /// Numero cesta inserito + /// + public string numCesta + { + get + { + return txtCesta.Text.Trim(); + } + set + { + txtCesta.Text = value; + } + } + /// + /// evento cambio num cesta/grappolo + /// + /// + /// + protected void txtCesta_TextChanged(object sender, EventArgs e) + { + txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4); + doUpdate(); + } + /// + /// verifica visibilità btn stampa UDC + /// + private void verificaBtnStampa() + { + bool showBtnStampa = false; + // se ho ALMENO 1 UDC + DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga; + bool hasUdc = false; + try + { + riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0]; + if (riga.UdcAssegnati > 0) hasUdc = true; + } + catch + { + } + if (hasUdc) + { + // se ho num cesta... + if (numCesta != "") + { + showBtnStampa = true; + } + } + divNote.Visible = showBtnStampa; + } + /// + /// genera e stampa AL + /// + /// + /// + protected void lbtGeneraAl_Click(object sender, EventArgs e) + { + // verifico postazione sia valida... + if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "") + { + /* generazione e stampa AL */ + string AL = ""; + string noteTrim = txtNote.Text.Trim(); + // creazione AL ed associazione UDC / spostamento... + try + { + AL = MagClass.magazzino.creaAssociaAlRxNt(tipoAL.AL_RxNt, Postazione.currCodCella, MagClass.magazzino.CodSoggCurrUser, DateTime.Now.Year, numCesta, noteTrim); + } + catch + { } + // lancio stampa + MagClass.magazzino.stampaAL(AL, Postazione.printer, Request.UserHostName); + // registro creazione AL + MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, AL, "", "creaAL", string.Format("Creato AL RX su linea {0}, note: {1} ", Postazione.currCodLinea, noteTrim)); + Postazione.CssClass = "stileAttesa"; + Postazione.warningText = ""; + Postazione.messaggiText = traduci("cartAlStampato"); + txtCesta.Text = ""; + // resetto particolare... + currParticolare = ""; + doUpdate(); + } + else + { + // ricarico che mi manca postazione! + Postazione.CssClass = "stileAttesa"; + Postazione.warningText = traduci("ERR-POS-001"); + Postazione.messaggiText = ""; + Response.Redirect(user_std.pagCorrente); + } + } + + protected void ods_Deleted(object sender, ObjectDataSourceStatusEventArgs e) + { + // aggiorno le qta! + qta = pezziUdc; + } + } +} \ No newline at end of file diff --git a/GMW/WebUserControls/mod_PostFin_DT.ascx.designer.cs b/GMW/WebUserControls/mod_PostFin_DT.ascx.designer.cs new file mode 100644 index 00000000..c2d0b6ab --- /dev/null +++ b/GMW/WebUserControls/mod_PostFin_DT.ascx.designer.cs @@ -0,0 +1,204 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace GMW.WebUserControls { + + + public partial class mod_PostFin_DT { + + /// + /// Controllo BundleReference1. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::Microsoft.AspNet.Web.Optimization.WebForms.BundleReference BundleReference1; + + /// + /// Controllo BundleReference2. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::Microsoft.AspNet.Web.Optimization.WebForms.BundleReference BundleReference2; + + /// + /// Controllo grView. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.GridView grView; + + /// + /// Controllo ods. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource ods; + + /// + /// Controllo lblIdxCella. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblIdxCella; + + /// + /// Controllo lblNumRec. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblNumRec; + + /// + /// Controllo lblDTFus. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblDTFus; + + /// + /// Controllo lblLinFus. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblLinFus; + + /// + /// Controllo lblParticolareAttivo. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblParticolareAttivo; + + /// + /// Controllo lblDescrAttivo. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblDescrAttivo; + + /// + /// Controllo lblDisegno. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblDisegno; + + /// + /// Controllo divBarcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divBarcode; + + /// + /// Controllo lblBarcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblBarcode; + + /// + /// Controllo txtBarcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.TextBox txtBarcode; + + /// + /// Controllo divNote. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNote; + + /// + /// Controllo txtNote. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.TextBox txtNote; + + /// + /// Controllo lbtGeneraAl. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtGeneraAl; + + /// + /// Controllo lbtGeneraUDC. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtGeneraUDC; + + /// + /// Controllo txtQta. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.TextBox txtQta; + + /// + /// Controllo lbtAddUdc. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtAddUdc; + + /// + /// Controllo txtCesta. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.TextBox txtCesta; + } +}