+ /// forza le delibere:
+ /// - la delibera DC x ogni NC aperta su UDC della lista
+ /// - la delibera logistica x gli UDC di trattamenti senza PM
+ ///
+ ///
+ protected void lbtForzaDL_Click(object sender, EventArgs e)
+ {
+ MagClass.magazzino.taRigheListePrelievo.setDlUdcSenzaDeliberaPM(currCodLista, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ lbtForzaDL.Visible = false;
+ resetSelezione();
+ }
+
+
+ #endregion
+ }
}
///
/// possibili stati del controllo
///
public enum ctrlMode
{
- standard = 0,
- nuovaLDP,
- setDestTipoLDP,
- scaricaMultiLDP
+ standard = 0,
+ nuovaLDP,
+ setDestTipoLDP,
+ scaricaMultiLDP
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_postRX_DT_LIST.ascx.cs b/GMW/WebUserControls/mod_postRX_DT_LIST.ascx.cs
index 2faef903..1cc1d4eb 100644
--- a/GMW/WebUserControls/mod_postRX_DT_LIST.ascx.cs
+++ b/GMW/WebUserControls/mod_postRX_DT_LIST.ascx.cs
@@ -8,921 +8,925 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_postRX_DT_LIST : System.Web.UI.UserControl
+ public partial class mod_postRX_DT_LIST : System.Web.UI.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// 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_DTE";
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// 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_DTE";
- 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 = "";
+ fixTipoInput();
+ fixCella();
+ traduciObj();
+ divDetDtx.Visible = false;
+ showAL(false, false);
+ }
+ doChecks();
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ qta = Convert.ToInt32(txtQta.Text.Trim());
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ 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
{
- if (!Page.IsPostBack)
+
+ 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 = "";
+ }
+ }
+ ///
+ /// sistema modalità input
+ ///
+ private void fixTipoInput()
+ {
+ bool barcodeEnabled = false;
+ if (rblInputMode.SelectedValue.ToUpper() == "BARCODE")
+ {
+ barcodeEnabled = true;
+ }
+ Postazione.messaggiText = traduci("attesaInput");
+ Postazione.warningText = "";
+ divElenco.Visible = !barcodeEnabled;
+ divBarcode.Visible = barcodeEnabled;
+ doUpdate();
+ }
+ ///
+ /// verifica se si debab mostrare un campo ricerca UDC attivo...
+ ///
+ private void fixCella()
+ {
+ hfCodLinea.Value = Postazione.currCodLinea;
+ }
+ ///
+ /// 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:
+ // permetto SOLO SE ho già AL --> lo associo
+ if (rigaCurr != null && rigaCurr.AL != "")
{
- currParticolare = "";
- lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus);
- lblLinFus.Text = lineaFus;
- Postazione.messaggiText = "";
+ string AlOk = rigaCurr.AL;
+ okDTL = getDateTimeLine(barcodeIn, false);
+ if (okDTL)
+ {
+ Postazione.messaggiText = traduci("SetDataFus");
Postazione.warningText = "";
- fixTipoInput();
- fixCella();
- traduciObj();
- divDetDtx.Visible = false;
- showAL(false, false);
- }
- doChecks();
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
+ Postazione.CssClass = "stileComandoOk";
+ // aggiunta fusione x tutti UDC dell'AL...
+ string AlOut = "";
+ DataMatrix_mgr.taL2D.addFusione(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, barcodeIn, ref AlOut);
+ if (AlOk != AlOut)
{
- 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 = "";
- }
- }
- ///
- /// sistema modalità input
- ///
- private void fixTipoInput()
- {
- bool barcodeEnabled = false;
- if (rblInputMode.SelectedValue.ToUpper() == "BARCODE")
- {
- barcodeEnabled = true;
- }
- Postazione.messaggiText = traduci("attesaInput");
- Postazione.warningText = "";
- divElenco.Visible = !barcodeEnabled;
- divBarcode.Visible = barcodeEnabled;
- doUpdate();
- }
- ///
- /// verifica se si debab mostrare un campo ricerca UDC attivo...
- ///
- private void fixCella()
- {
- hfCodLinea.Value = Postazione.currCodLinea;
- }
- ///
- /// 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:
- // permetto SOLO SE ho già AL --> lo associo
- if (rigaCurr != null && rigaCurr.AL != "")
- {
- string AlOk = rigaCurr.AL;
- okDTL = getDateTimeLine(barcodeIn, false);
- if (okDTL)
- {
- Postazione.messaggiText = traduci("SetDataFus");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- // aggiunta fusione x tutti UDC dell'AL...
- string AlOut = "";
- DataMatrix.mgr.taL2D.addFusione(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, barcodeIn, ref AlOut);
- if (AlOk != AlOut)
- {
- Postazione.messaggiText = traduci("ERR-BCD-006");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- barcodeIn = "";
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-004");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-005");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.DateTimeLine:
- // permetto SOLO SE ho già AL --> lo associo
- if (rigaCurr != null && rigaCurr.AL != "")
- {
- string AlOk = rigaCurr.AL;
- okDTL = getDateTimeLine(barcodeIn, true);
- if (okDTL)
- {
- Postazione.messaggiText = traduci("SetDataFus");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- // aggiunta fusione x tutti UDC dell'AL...
- string AlOut = "";
- DataMatrix.mgr.taL2D.addFusione(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, barcodeIn, ref AlOut);
- if (AlOk != AlOut)
- {
- Postazione.messaggiText = traduci("ERR-BCD-006");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- barcodeIn = "";
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-004");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-005");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- 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
- {
- // 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);
- }
- 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 != "")
- {
- // dataOra timbratura dtx...
- DateTime dataLett = DateTime.Now;
- // ricavo dati particolare
- string descrPart = "";
- //string disegnoPart = "";
- try
- {
- DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
- descrPart = riga.DescParticolare;
- }
- catch
- { }
-
- // 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);
- bool marcaturaOk = false;
- if (tabDmtx.Rows.Count > 0)
- {
- // verifica esitoMarcatura
- marcaturaOk = (tabDmtx[0].EsitoMarcatura == "OK");
- }
-
- qta = 1; // tanto poi si ricalcola...
- // 2017.02.21 verifico DTX sia OK
- if (marcaturaOk)
- {
- // verifico SE NON HO ancora un record...
- bool nuovaLettura = true;
- try
- {
- //nuovaLettura = DataMatrix.mgr.taL2D.getByLineaPart(Postazione.currCodLinea, currParticolare).Rows.Count == 0;
- nuovaLettura = rigaCurr == null;
- }
- catch
- { }
- // non ho il record --> creo con NUOVO DTX letto (inizio)
- if (nuovaLettura)
- {
- DataMatrix.mgr.taL2D.insertIni(Postazione.currCodLinea, FormatoDtmxLinea, barcodeIn, MagClass.magazzino.CodSoggCurrUser, dataLett);
- }
- // c'è già un record --> chiudo impostando/aggiornando il record di ULTIMO DMTX
- else
- {
- DataMatrix.mgr.taL2D.updateEnd(Postazione.currCodLinea, FormatoDtmxLinea, barcodeIn, MagClass.magazzino.CodSoggCurrUser, dataLett);
- }
-
- }
- else
- {
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("ERR-DTX-012");
- Postazione.CssClass = "stileComandoKo";
- }
-
- // 2017.07.22 svuoto barcodeIn..
- barcodeIn = "";
- }
- }
- }
- }
- }
- else
- {
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("DtxGiaAssegnato");
- Postazione.CssClass = "stileComandoKo";
- }
- break;
-
- default:
- Postazione.warningText = traduci("ERR-UNK-001");
- Postazione.CssClass = "stileComandoND";
- break;
+ Postazione.messaggiText = traduci("ERR-BCD-006");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("ERR-BCD-004");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
+ }
}
else
{
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
+ Postazione.messaggiText = traduci("ERR-BCD-005");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
- 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
+ break;
+ case tipoCodiceBarcode.DateTimeLine:
+ // permetto SOLO SE ho già AL --> lo associo
+ if (rigaCurr != null && rigaCurr.AL != "")
{
- newData = val2decode.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(0, 10);
- if (newData != "")
+ string AlOk = rigaCurr.AL;
+ okDTL = getDateTimeLine(barcodeIn, true);
+ if (okDTL)
+ {
+ Postazione.messaggiText = traduci("SetDataFus");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ // aggiunta fusione x tutti UDC dell'AL...
+ string AlOut = "";
+ DataMatrix_mgr.taL2D.addFusione(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, barcodeIn, ref AlOut);
+ if (AlOk != AlOut)
{
- dataFus = DateTime.ParseExact(newData, "yyMMddHHmm", CultureInfo.InvariantCulture);
- okData = true;
+ Postazione.messaggiText = traduci("ERR-BCD-006");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("ERR-BCD-004");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
+ }
}
- catch
+ else
{
- dataFus = oldDataFus;
+ Postazione.messaggiText = traduci("ERR-BCD-005");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
- if (readline)
+ break;
+ case tipoCodiceBarcode.DataMatrixTrovato:
+ // controllo che il DTX non sia già assegnato...
+ if (DataMatrix_mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0)
{
- if (okData)
+ // 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
+ {
+ // 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
{
- 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))
+ // vers 2.9 modifica per multi-datamatrix
+ currParticolare = partByDtmx(true);
+ }
+ 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 != "")
+ {
+ // dataOra timbratura dtx...
+ DateTime dataLett = DateTime.Now;
+ // ricavo dati particolare
+ string descrPart = "";
+ //string disegnoPart = "";
+ try
+ {
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descrPart = riga.DescParticolare;
+ }
+ catch
+ { }
+
+ // 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);
+ bool marcaturaOk = false;
+ if (tabDmtx.Rows.Count > 0)
+ {
+ // verifica esitoMarcatura
+ marcaturaOk = (tabDmtx[0].EsitoMarcatura == "OK");
+ }
+
+ qta = 1; // tanto poi si ricalcola...
+ // 2017.02.21 verifico DTX sia OK
+ if (marcaturaOk)
+ {
+ // verifico SE NON HO ancora un record...
+ bool nuovaLettura = true;
+ try
{
- lineaFus = newLinea;
- okLinea = true;
+ //nuovaLettura = DataMatrix_mgr.taL2D.getByLineaPart(Postazione.currCodLinea, currParticolare).Rows.Count == 0;
+ nuovaLettura = rigaCurr == null;
}
+ catch
+ { }
+ // non ho il record --> creo con NUOVO DTX letto (inizio)
+ if (nuovaLettura)
+ {
+ DataMatrix_mgr.taL2D.insertIni(Postazione.currCodLinea, FormatoDtmxLinea, barcodeIn, MagClass.magazzino.CodSoggCurrUser, dataLett);
+ }
+ // c'è già un record --> chiudo impostando/aggiornando il record di ULTIMO DMTX
else
{
- lineaFus = "";
- dataFus = oldDataFus;
+ DataMatrix_mgr.taL2D.updateEnd(Postazione.currCodLinea, FormatoDtmxLinea, barcodeIn, MagClass.magazzino.CodSoggCurrUser, dataLett);
}
+
+ }
+ else
+ {
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-012");
+ Postazione.CssClass = "stileComandoKo";
+ }
+
+ // 2017.07.22 svuoto barcodeIn..
+ barcodeIn = "";
}
- catch
- {
- lineaFus = "";
- dataFus = oldDataFus;
- }
- }
- else
- {
- lineaFus = "";
+ }
}
+ }
}
else
{
- okLinea = true;
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("DtxGiaAssegnato");
+ Postazione.CssClass = "stileComandoKo";
}
- return okData && okLinea;
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- fixCella();
- grView.DataBind();
- // se selezionato qualcosa mostro dettaglio
- divDetDtx.Visible = (grView.SelectedIndex >= 0);
- grViewDet.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();
- verificaBtnStampa();
- txtBarcode.Focus();
- }
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- resetSelezione();
- }
- ///
- /// resetta la selezione dei valori in caso di modifiche su altri controlli
- ///
- public void resetSelezione()
- {
- grView.SelectedIndex = -1;
- doUpdate();
- }
- ///
- /// 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;
- // calcolo qta a partire da particolare selezionato...
- try
- {
- //DS_DataMatrix.Linea2Dtx_IEDataTable tabL2D = DataMatrix.mgr.taL2D.getByLineaPart(Postazione.currCodLinea, currParticolare);
- //if (tabL2D.Rows.Count > 0)
- //{
- // answ = tabL2D[0].Qta;
- //}
- DS_DataMatrix.Linea2Dtx_IERow riga = rigaCurr;
- if (riga != null)
- {
- answ = riga.Qta;
- }
- }
- 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);
- }
- }
- ///
- /// cambiato tipo di richiesta di input
- ///
- ///
- ///
- protected void rblInputMode_SelectedIndexChanged(object sender, EventArgs e)
- {
- fixTipoInput();
- }
- ///
- /// salvo il particolare selezionato...
- ///
- ///
- ///
- protected void lbtAddPart_Click(object sender, EventArgs e)
- {
- // imposto il particolare corrente
- currParticolare = ddlPart.SelectedValue;
- 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");
- }
- doUpdate();
- }
+ break;
- ///
- /// evento selezione: ricarico dati!
- ///
- ///
- ///
- protected void grView_SelectedIndexChanged(object sender, EventArgs e)
- {
- 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();
- }
- ///
- /// Restituisce record riga corrente
- ///
- protected DS_DataMatrix.Linea2Dtx_IERow rigaCurr
- {
- get
- {
- DS_DataMatrix.Linea2Dtx_IERow answ = null;
- DS_DataMatrix.Linea2Dtx_IEDataTable tab = null;
- try
- {
-
- tab = DataMatrix.mgr.taL2D.getByLineFormato(Postazione.currCodLinea, FormatoDtmxLinea);
- if (tab.Rows.Count > 0)
- {
- answ = tab[0];
- }
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// verifica visibilità btn stampa UDC
- ///
- private void verificaBtnStampa()
- {
- // SOLO SE ho la riga..
- if (rigaCurr != null)
- {
- DS_DataMatrix.Linea2Dtx_IERow riga = rigaCurr;
- // controllo cosa posso visualizzare tra CREA UDC e STAMPA AL
- bool hasAL = false;
- bool hasQta = false;
- bool hasPmUm = false;
- try
- {
- if (riga.AL != "") hasAL = true;
- if (riga.Qta > 0) hasQta = true;
- if (riga.DTX_INI != "" && riga.DTX_END != "") hasPmUm = true;
- }
- catch
- { }
- // se ho AL mostro stampa!
- showAL(hasQta && hasPmUm && numCesta != "", hasAL);
- }
- }
- ///
- /// Determina se mostrare creazione/stampa AL
- ///
- ///
- ///
- private void showAL(bool showCreate, bool showPrint)
- {
- divNote.Visible = showCreate || showPrint;
- lbtGeneraAl.Visible = showCreate && !showPrint;
- lbtStampaAL.Visible = showPrint;
- txtCesta.Enabled = !showPrint;
- }
-
- ///
- /// genera e stampa AL
- ///
- ///
- ///
- protected void lbtGeneraAl_Click(object sender, EventArgs e)
- {
- // verifico postazione sia valida...
- if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
- {
- /* generazione AL DA RIVEDERE */
- string AL = "";
- string noteTrim = txtNote.Text.Trim();
- // creazione AL ed associazione UDC / spostamento...
- try
- {
- // creo UDC ed AL
- AL = MagClass.magazzino.creaAssociaAlUdcRxDt(Postazione.currCodLinea, FormatoDtmxLinea, codEventoUdc, statoUDC, tipoAL.AL_RxDt, Postazione.currCodCella, MagClass.magazzino.CodSoggCurrUser, DateTime.Now.Year, numCesta, noteTrim);
- }
- catch
- { }
- if (AL != "")
- {
- Postazione.CssClass = "stileComandoOk";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("GEN-AL-UDC-OK");
- Response.Redirect(user_std.pagCorrente);
- }
- }
- 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)
- {
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = "";
- currParticolare = "";
- qta = 0;
- doUpdate();
- eh_reqUpdate?.Invoke(this, new EventArgs());
- }
-
- protected void lbtStampaAL_Click(object sender, EventArgs e)
- {
- // verifico postazione sia valida...
- if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
- {
- string noteTrim = txtNote.Text.Trim();
- /* stampa AL */
- string AlOut = "";
- string AL = rigaCurr.AL;
- // sistemo pre-stampa
- try
- {
- // update pre-stampa...
- DataMatrix.mgr.taL2D.sistemaPreStampa(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, codEventoUdc, noteTrim, ref AlOut);
- }
- catch
- { }
- // se gli AL corrispondono...
- if (AL != AlOut)
- {
- Postazione.messaggiText = traduci("ERR-BCD-006");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- // 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 = "";
- // elimino note
- txtNote.Text = "";
- // resetto particolare...
- currParticolare = "";
- qta = 0;
- }
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- // ricarico che mi manca postazione!
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = traduci("ERR-POS-001");
- Postazione.messaggiText = "";
- Response.Redirect(user_std.pagCorrente);
- }
+ 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();
+ // se selezionato qualcosa mostro dettaglio
+ divDetDtx.Visible = (grView.SelectedIndex >= 0);
+ grViewDet.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();
+ verificaBtnStampa();
+ txtBarcode.Focus();
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ resetSelezione();
+ }
+ ///
+ /// resetta la selezione dei valori in caso di modifiche su altri controlli
+ ///
+ public void resetSelezione()
+ {
+ grView.SelectedIndex = -1;
+ doUpdate();
+ }
+ ///
+ /// 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;
+ // calcolo qta a partire da particolare selezionato...
+ try
+ {
+ //DS_DataMatrix.Linea2Dtx_IEDataTable tabL2D = DataMatrix_mgr.taL2D.getByLineaPart(Postazione.currCodLinea, currParticolare);
+ //if (tabL2D.Rows.Count > 0)
+ //{
+ // answ = tabL2D[0].Qta;
+ //}
+ DS_DataMatrix.Linea2Dtx_IERow riga = rigaCurr;
+ if (riga != null)
+ {
+ answ = riga.Qta;
+ }
+ }
+ 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);
+ }
+ }
+ ///
+ /// cambiato tipo di richiesta di input
+ ///
+ ///
+ ///
+ protected void rblInputMode_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ fixTipoInput();
+ }
+ ///
+ /// salvo il particolare selezionato...
+ ///
+ ///
+ ///
+ protected void lbtAddPart_Click(object sender, EventArgs e)
+ {
+ // imposto il particolare corrente
+ currParticolare = ddlPart.SelectedValue;
+ 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");
+ }
+ doUpdate();
+ }
+
+ ///
+ /// evento selezione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ 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();
+ }
+ ///
+ /// Restituisce record riga corrente
+ ///
+ protected DS_DataMatrix.Linea2Dtx_IERow rigaCurr
+ {
+ get
+ {
+ DS_DataMatrix.Linea2Dtx_IERow answ = null;
+ DS_DataMatrix.Linea2Dtx_IEDataTable tab = null;
+ try
+ {
+
+ tab = DataMatrix_mgr.taL2D.getByLineFormato(Postazione.currCodLinea, FormatoDtmxLinea);
+ if (tab.Rows.Count > 0)
+ {
+ answ = tab[0];
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// verifica visibilità btn stampa UDC
+ ///
+ private void verificaBtnStampa()
+ {
+ // SOLO SE ho la riga..
+ if (rigaCurr != null)
+ {
+ DS_DataMatrix.Linea2Dtx_IERow riga = rigaCurr;
+ // controllo cosa posso visualizzare tra CREA UDC e STAMPA AL
+ bool hasAL = false;
+ bool hasQta = false;
+ bool hasPmUm = false;
+ try
+ {
+ if (riga.AL != "") hasAL = true;
+ if (riga.Qta > 0) hasQta = true;
+ if (riga.DTX_INI != "" && riga.DTX_END != "") hasPmUm = true;
+ }
+ catch
+ { }
+ // se ho AL mostro stampa!
+ showAL(hasQta && hasPmUm && numCesta != "", hasAL);
+ }
+ }
+ ///
+ /// Determina se mostrare creazione/stampa AL
+ ///
+ ///
+ ///
+ private void showAL(bool showCreate, bool showPrint)
+ {
+ divNote.Visible = showCreate || showPrint;
+ lbtGeneraAl.Visible = showCreate && !showPrint;
+ lbtStampaAL.Visible = showPrint;
+ txtCesta.Enabled = !showPrint;
+ }
+
+ ///
+ /// genera e stampa AL
+ ///
+ ///
+ ///
+ protected void lbtGeneraAl_Click(object sender, EventArgs e)
+ {
+ // verifico postazione sia valida...
+ if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
+ {
+ /* generazione AL DA RIVEDERE */
+ string AL = "";
+ string noteTrim = txtNote.Text.Trim();
+ // creazione AL ed associazione UDC / spostamento...
+ try
+ {
+ // creo UDC ed AL
+ AL = MagClass.magazzino.creaAssociaAlUdcRxDt(Postazione.currCodLinea, FormatoDtmxLinea, codEventoUdc, statoUDC, tipoAL.AL_RxDt, Postazione.currCodCella, MagClass.magazzino.CodSoggCurrUser, DateTime.Now.Year, numCesta, noteTrim);
+ }
+ catch
+ { }
+ if (AL != "")
+ {
+ Postazione.CssClass = "stileComandoOk";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("GEN-AL-UDC-OK");
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ 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)
+ {
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = "";
+ currParticolare = "";
+ qta = 0;
+ doUpdate();
+ eh_reqUpdate?.Invoke(this, new EventArgs());
+ }
+
+ protected void lbtStampaAL_Click(object sender, EventArgs e)
+ {
+ // verifico postazione sia valida...
+ if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
+ {
+ string noteTrim = txtNote.Text.Trim();
+ /* stampa AL */
+ string AlOut = "";
+ string AL = rigaCurr.AL;
+ // sistemo pre-stampa
+ try
+ {
+ // update pre-stampa...
+ DataMatrix_mgr.taL2D.sistemaPreStampa(Postazione.currCodLinea, FormatoDtmxLinea, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, codEventoUdc, noteTrim, ref AlOut);
+ }
+ catch
+ { }
+ // se gli AL corrispondono...
+ if (AL != AlOut)
+ {
+ Postazione.messaggiText = traduci("ERR-BCD-006");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ // 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 = "";
+ // elimino note
+ txtNote.Text = "";
+ // resetto particolare...
+ currParticolare = "";
+ qta = 0;
+ }
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ // ricarico che mi manca postazione!
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = traduci("ERR-POS-001");
+ Postazione.messaggiText = "";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_post_B48.ascx.cs b/GMW/WebUserControls/mod_post_B48.ascx.cs
index d00f53b1..0f07a23d 100644
--- a/GMW/WebUserControls/mod_post_B48.ascx.cs
+++ b/GMW/WebUserControls/mod_post_B48.ascx.cs
@@ -5,1081 +5,1084 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_post_B48 : System.Web.UI.UserControl
+ public partial class mod_post_B48 : System.Web.UI.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// flusso associato (hard coded) a FI
+ ///
+ protected string flusso = "FI";
+ ///
+ /// stato associato (hard coded) a RX in GitterBox
+ ///
+ protected string statoUdcOut = "FinRx";
+ ///
+ /// codice evento dell'UDC che si crea
+ ///
+ protected string codEventoUdcOut = "UDC_RXF_DT";
+ ///
+ /// Qta imbalo desiderato
+ ///
+ protected int QtaImballoRXFin
{
-
- ///
- /// flusso associato (hard coded) a FI
- ///
- protected string flusso = "FI";
- ///
- /// stato associato (hard coded) a RX in GitterBox
- ///
- protected string statoUdcOut = "FinRx";
- ///
- /// codice evento dell'UDC che si crea
- ///
- protected string codEventoUdcOut = "UDC_RXF_DT";
- ///
- /// Qta imbalo desiderato
- ///
- protected int QtaImballoRXFin
- {
- get
- {
- return memLayer.ML.cdvi("QtaImballoRXFin");
- }
- }
-
-
- ///
- /// stringa UID univoca
- ///
- public string uid
- {
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
- }
-
- ///
- /// flusso associato (hard coded) ad ancestor TT (Trattati)
- ///
- protected string flussoAnc = "TT";
- ///
- /// flusso associato (hard coded) a temporaneo TL (Trattati/Liquidi)
- ///
- protected string flussoTemp = "TL";
- ///
- /// stato associato (hard coded) a UDC in IN: Trattato da travaso AL
- ///
- protected string statoUdcIn = "Tratt";
- ///
- /// codice evento dell'UDC temporaneo (IN) che si crea
- ///
- protected string codEventoUdcIn = "UDC_TRATT";
-
- protected string cssOk = "stileComandoOk";
- protected string cssErr = "stileComandoKo";
- protected string cssWait = "stileComandoND";
- protected string cssAtt = "stileAttesa";
- protected string cssWarn = "stileComandoWarn";
- protected string cssAdd = "stileComandoAdd";
- public event EventHandler eh_reqUpdate;
-
- ///
- /// ultimo valore barcode letto (x confronto conferme doppio input...)
- ///
- protected string lastBarcodeIn
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("lastBCode_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("lastBCode_{0}", uid), value, false);
- }
- }
- ///
- /// Codice AL della cella corrente
- ///
- protected string destAL
- {
- get
- {
- return lblDestAL.Text.Trim();
- }
- set
- {
- lblDestAL.Text = value;
- }
- }
- ///
- /// Codice AL associato alla cella corrente...
- ///
- protected string AlByCella
- {
- get
- {
- string answ = "";
- try
- {
- answ = string.Format("ALF00{0}", Postazione.currCodCella);
- // controllo se esista AL sennò lo creo...
- if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
- {
- MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
- }
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// 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"));
- }
- }
- ///
- /// indica UDC correntemente selezionato
- ///
- protected string currUDC
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
- }
- ///
- /// num pezzi dell'ultimo UDC di uguale particolare e stato fatto...
- ///
- public int pezziUdc
- {
- get
- {
- int answ = 0;
- try
- {
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStatoConImb(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUdcOut)[0].Qta;
- }
- catch
- {
- answ = memLayer.ML.cdvi("QtaImballoFiniti");
- }
- return answ;
- }
- }
- ///
- /// cod imballo dell'ultimo UDC del particolare generato
- ///
- public string lastCodImb
- {
- get
- {
- string answ = "";
- try
- {
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStatoConImb(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUdcOut)[0].CodImballo;
- }
- catch
- {
- answ = memLayer.ML.cdv("CodImballoFiniti");
- }
- return answ;
- }
- }
- ///
- /// 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();
- }
- }
- ///
- /// 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)
- {
- answ = DataMatrix.mgr.taDtxAcquisiti.getByKey(barcodeIn)[0].Particolare; // Decode.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;
- }
- }
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- qta = 0;
- currUDC = "";
- forceDelete = false;
- setDefaultVal();
- checkNumKeyIn();
- }
- setVisibility(!Page.IsPostBack);
- checkBarcode();
- }
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
- }
- ///
- /// imposta i valori di default ad avvio
- ///
- private void setDefaultVal()
- {
- destAL = AlByCella;
- }
- ///
- /// sistema modalità input
- ///
- /// forza reload imballo?
- private void setVisibility(bool forceReloadImb)
- {
- bool showBtn = false;
- // controllo btn quantità
- if (grViewDest.SelectedIndex >= 0)
- {
- showBtn = true;
- }
- divQta.Visible = showBtn;
- divImballi.Visible = showBtn;
- if (showBtn && forceReloadImb)
- {
- selezionaImballo();
- }
- }
- ///
- /// reset maschera...
- ///
- protected void doReset()
- {
- // resetta
- lastBarcodeIn = "";
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- Postazione.CssClass = cssAtt;
- doUpdate();
- }
- ///
- /// Verifica l'AL se sia ok x procedere:
- /// - Attivo
- ///
- ///
- /// T/L
- ///
- protected bool checkAL(string AL, string tipo)
- {
- bool answ = false;
- try
- {
- answ = MagClass.magazzino.taEA.getByAL_TipoAttivo(AL, tipo).Rows.Count > 0;
- }
- catch
- { }
- if (answ)
- {
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- Postazione.warningText = traduci("ErroreAlNonTtAttivo");
- Postazione.CssClass = "stileComandoKo";
- }
-
- return answ;
- }
- ///
- /// Verifica l'AL se abbia datamatrix
- ///
- ///
- ///
- protected bool checkDtxAL(string AL)
- {
- bool answ = false;
- try
- {
- answ = DataMatrix.mgr.taDtx2UDC.getByAL(AL).Rows.Count > 0;
- }
- catch
- { }
- if (!answ)
- {
- Postazione.warningText = traduci("ErroreAlNonDtx");
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- return answ;
- }
- ///
- /// controlla se ci sia un barcode e cosa farne...
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
- tipoCodiceBarcode tipoBC = MagClass.tipoBCode_L5(barcodeIn);
- switch (tipoBC)
- {
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- case tipoCodiceBarcode.Imballo:
- // cerco di selezionare!
- try
- {
- ddlImballi.SelectedValue = barcodeIn;
- }
- catch
- {
- Postazione.warningText = traduci("ERR-IMB-001");
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Comando:
- // se è reset cancello tutto!
- if (barcodeIn == memLayer.ML.cdv("cmdReset"))
- {
- doReset();
- }
- break;
- case tipoCodiceBarcode.UDC:
- // controllo di avere destAL valido, sennò ricarico pagina...
- if (destAL.Length > 5)
- {
- // controllo se sia un UDC valido...
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // controllo se sia un UDC di finiti LIQ in posizione 4...
- DS_magazzino.ElencoCartelliniRow cartUDC = MagClass.magazzino.taCartellini.getByUdc(barcodeIn)[0];
- if (cartUDC.CodStato == statoUdcOut && cartUDC.IdxPosizione == memLayer.ML.cdvi("IdxPosizioneFiniti"))
- {
- // controllo NON ci sia già un UDC di pari particolare caricato nella postazione corrente (non posso avere 2 UDC a pari particolare da riempire...)
- if (MagClass.magazzino.taCartellini.getByParticolareAL(cartUDC.Particolare, destAL).Rows.Count == 0)
- {
- // controllo NON sia UDC in LDP e già PRELEVATO
- if (MagClass.magazzino.taRigheListePrelievo.getByUdc(barcodeIn).Select("Prelevato = 1").Length == 0)
- {
- // controllo NON abbia blocco x FinDtx...
- if (MagClass.magazzino.udcHasAttr(barcodeIn, "BL"))
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-006");
- Postazione.CssClass = cssErr;
- }
- else
- {
- // se è ok RICARICO UDC in posizione corrente...
- bool fatto = MagClass.magazzino.finRxRiprendiInCaricoUDC(barcodeIn, MagClass.magazzino.CodSoggCurrUser, destAL, Postazione.currIdxCella);
- if (fatto)
- {
- Postazione.messaggiText = traduci("RiCaricatoUdcLiq");
- Postazione.warningText = "";
- Postazione.CssClass = cssOk;
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-001");
- Postazione.CssClass = cssErr;
- }
- }
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-005");
- Postazione.CssClass = cssErr;
- }
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-004");
- Postazione.CssClass = cssErr;
- }
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-002");
- Postazione.CssClass = cssErr;
- }
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-LIQ-003");
- Postazione.CssClass = cssErr;
- }
- }
- else
- {
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-ALF-001");
- Postazione.CssClass = cssErr;
- }
- break;
- case tipoCodiceBarcode.DataMatrixTrovato:
- // ciclo controllo x B48
- string NewUDC = "";
- // verifica preliminare: se Dtx OK procedo, se è KO NON LO CONSIDERO PROPRIO
- bool isOk = false;
- // controllo anche NC
- bool isOkNc = false;
- // controllo sia libero (= non assegnato)
- bool isFree= false;
- try
- {
- isOk = DataMatrix.mgr.taVerifica.GetData(barcodeIn)[0].StatoDtx == "OK";
- }
- catch
- { }
- try
- {
- isOkNc = DataMatrix.mgr.taAtt2Dtx.getByDtx(barcodeIn).Select("CodAttr = 'XF'").Length == 0;
- }
- catch
- { }
- try
- {
- isFree = DataMatrix.mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0;
- }
- catch
- { }
- // controlli x procedere
- if (!isOkNc && !chkDtxMode.Checked)
- {
- // non accetto Dtx e mostro errore
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("ERR-DTX-016");
- Postazione.CssClass = cssErr;
- }
- else if (!isOk && !chkDtxMode.Checked)
- {
- // non accetto Dtx e mostro errore
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("ERR-DTX-012");
- Postazione.CssClass = cssErr;
- }
- else if (!isFree && !chkDtxMode.Checked)
- {
- // non accetto Dtx e mostro errore
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("ERR-DTX-017");
- Postazione.CssClass = cssErr;
- }
- else if (isFree && chkDtxMode.Checked)
- {
- // non accetto Dtx e mostro errore
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("ERR-DTX-018");
- Postazione.CssClass = cssErr;
- }
- else // PROCEDO!!!
- {
-
- // 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
- {
- // calcolo particolare + UDC dest
- try
- {
- currParticolare = partByDtmx(true);
- // se non ho UDC lo creo...
- checkCreaUDC();
- // verifico se ho UDC...
- NewUDC = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in decodifica particolare da DataMatrix:{0}dtx:{1}{0}Eccezione:{0}{2}", Environment.NewLine, barcodeIn, exc), tipoLog.EXCEPTION);
- NewUDC = "";
- }
- // ora proseguo...
- if (currParticolare != "" && NewUDC != "")
- {
- // chiamo procedure aggiunta/rimozione secondo caso di selezione ADD/REM Dtx
- if (!chkDtxMode.Checked)
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("DtxAdd"), barcodeIn);
- Postazione.CssClass = "stileComandoOk";
- procDtx_add(ref NewUDC);
- }
- // modalità "rimozione" datamatrix
- else
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("DtxRem"), barcodeIn);
- Postazione.CssClass = "stileComandoWarn";
- procDtx_rem(ref NewUDC);
- }
- }
- }
- }
- }
- break;
- default:
- Postazione.warningText = traduci("ERR-BCD-001");
- Postazione.CssClass = cssErr;
- break;
- }
- barcodeIn = "";
- }
- doUpdate();
- }
-
- ///
- /// 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("IdxPosizioneRxFinTemp"), 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, statoUdcOut, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), "IdxPosizioneRxFinTemp", codEventoUdcOut, noteTrim, "", adesso.Year, Request.UserHostName);
- // lo associo all'AL...
- MagClass.magazzino.taAL2UDC.Insert(destAL, newUdcChild, adesso, MagClass.magazzino.CodSoggCurrUser);
-
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in creazione UDC temp RX Fin: {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");
- doUpdate();
- }
- }
-
- #region metodi processing DataMatrix letto da BarCode
-
- ///
- /// processa aggiunta datamatrix (SE POSSIBILE)
- ///
- ///
- private void procDtx_add(ref string NewUDC)
- {
- // genera eventuale UDC del particolare su cella/posizione corrente
- qta = 1; // tanto poi si ricalcola...
- checkCreaUDC();
- // controllo che il DTX non sia già assegnato...
- if (DataMatrix.mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0)
- {
- // verifico NON CI SIANO attributi DC pendenti (nel qual caso memorizzo primo comando e poi chiedo conferma... !!!FARE!!!
- bool hasXQ = false;
- if (DataMatrix.mgr.taAtt2Dtx.getByDtx(barcodeIn).Rows.Count > 0)
- {
- // cerco se abbia "XQ"...
- if (DataMatrix.mgr.taAtt2Dtx.getByDtx(barcodeIn).Select("CodAttr = 'XQ'").Length > 0)
- {
- hasXQ = true;
- }
- }
- if (hasXQ)
- {
- // verifico se c'è già in sessione la lettura di questo DataMatrix...
- if (memLayer.ML.StringSessionObj("prevDmtx") == barcodeIn)
- {
- // è seconda lettura: allora procedo
- hasXQ = false;
- // svuoto da sessione
- memLayer.ML.emptySessionVal("prevDmtx");
- }
- }
- // se non ho pendenze...
- if (!hasXQ)
- {
- // chiamo la stored che associa Dtx a UDC
- DataMatrix.mgr.taDtx2UDC.RxSetDtx2Udc(barcodeIn, MagClass.magazzino.CodSoggCurrUser, statoUdcOut, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), Postazione.currIdxCella);
- }
- else
- {
- // mostro messaggio che chiede seconda lettura conferma e salvo in sessione...
- Postazione.messaggiText = barcodeIn;
- Postazione.warningText = traduci("B48_ReadTwiceToConfirm");
- Postazione.CssClass = "stileComandoWarn";
- // salvo in sessione dmtx x conferma
- memLayer.ML.setSessionVal("prevDmtx", barcodeIn);
- }
- }
- }
- ///
- /// processa rimozione datamatrix (se possibile)
- ///
- ///
- private void procDtx_rem(ref string NewUDC)
- {
- // verifico sia nell'UDC dest
- if (DataMatrix.mgr.taDtx2UDC.getByDtxAl(destAL, barcodeIn).Rows.Count != 0)
- {
- // rimuovo Dtx
- DataMatrix.mgr.taDtx2UDC.deleteQuery(DataMatrix.mgr.taDtx2UDC.getByDtxAl(destAL, barcodeIn)[0].UDC, barcodeIn, MagClass.magazzino.CodSoggCurrUser, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), Postazione.currIdxCella);
- // assegno Attributo x indicare che è stato rimosso...
- DataMatrix.mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XQ", "Rim. UDC B48", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- }
- }
-
- #endregion
-
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- setDefaultVal();
- setVisibility(!Page.IsPostBack);
- grViewDest.DataBind();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- verificaBtnStampa();
- txtBarcode.Focus();
- }
- ///
- /// evento selezione grView destinazione: ricarico dati!
- ///
- ///
- ///
- protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
- {
- // ricarico dati dell'UDC come particolare e quantità...
- currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
- int qtaDtx = 0;
- if (MagClass.magazzino.checkUDC(currUDC))
- {
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
- qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
- qtaDtx = Convert.ToInt32(MagClass.magazzino.taA2U2D.getByUDC(currUDC)[0].QtaDtx);
- // imposto particolare...
- lblPart.Text = currParticolare;
- ddlImballi.DataBind();
- }
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- setVisibility(true);
- doUpdate();
- // fisso focus su note!
- txtNote.Focus();
- }
- ///
- /// prende in carico AL selezionato
- ///
- ///
- ///
- protected void lbtPrendeCaricoAL_Click(object sender, EventArgs e)
- {
- doUpdate();
- }
- ///
- /// variabile force delete salvata...
- ///
- protected bool forceDelete
- {
- get
- {
- return memLayer.ML.BoolSessionObj(string.Format("ForceDelAL_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("ForceDelAL_{0}", uid), value);
- }
- }
- ///
- /// Verifica se Assieme sia vuoto (no DTX negli UDC)
- ///
- /// Codice AL
- ///
- protected bool assiemeIsEmpty(string AL)
- {
- bool answ = false;
- try
- {
- answ = DataMatrix.mgr.taDtx2UDC.getByAL(AL).Rows.Count == 0;
- }
- catch { }
- return answ;
- }
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- grViewDest.SelectedIndex = -1;
- qta = 0;
- currUDC = "";
- setVisibility(false);
- doUpdate();
- }
- ///
- /// update Qty x UDC selezionato...
- ///
- ///
- ///
- protected void lbtUpdQty_Click(object sender, EventArgs e)
- {
- MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", codEventoUdcOut, qta);
- currUDC = "";
- currParticolare = "";
- grViewDest.SelectedIndex = -1;
- doUpdate();
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- bool fatto = false;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- // registro ri-stampa UDC
- if (fatto) MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, "", "stampaUDC", string.Format("Ri-Stampato UDC Dtx {0} su linea {1}", currUDC, Postazione.currCodLinea));
- }
- ///
- /// verifica visibilità btn stampa UDC
- ///
- private void verificaBtnStampa()
- {
- bool showBtnStampa = false;
- // se ho selezionato udc...
- if (currUDC != "")
- {
- DS_magazzino.v_A2U2DRow riga;
- int qtaUDC = 0;
- int qtaDtx = 0;
- try
- {
- riga = MagClass.magazzino.taA2U2D.getByUDC(currUDC)[0];
- qtaUDC = Convert.ToInt32(riga.Qta);
- qtaDtx = riga.QtaDtx;
- }
- catch
- { }
- if (qtaUDC > 0 && (qtaUDC <= QtaImballoRXFin))
- {
- // se le qta voluta e dtx sono uguali...
- if (qtaUDC == qtaDtx)
- {
- showBtnStampa = true;
- }
- }
- }
- divNote.Visible = showBtnStampa;
- }
- ///
- /// fornisce in output la corretta classe css x icona
- ///
- ///
- ///
- ///
- public string cssGlyphByQty(object _qta, object _qtaDtx)
- {
- string answ = "glyphicon glyphicon-pencil btn-lg";
- int qtaUDC = 0;
- int qtaDtx = -1;
- try
- {
- qtaUDC = Convert.ToInt32(_qta);
- }
- catch { }
- try
- {
- qtaDtx = Convert.ToInt32(_qtaDtx);
- }
- catch { }
- if ((qtaUDC == qtaDtx) && (qtaUDC == QtaImballoRXFin))
- {
- answ = "glyphicon glyphicon-print btn-lg";
- }
- return answ;
- }
- ///
- /// effettua processo di sistemazione UDC e stampa
- ///
- ///
- ///
- protected void lbtStampaUDC_Click(object sender, EventArgs e)
- {
- // verifico postazione sia valida...
- if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
- {
- // fa le operazioni di update x UDC e poi lo stampa
- bool fatto = false;
- string noteTrim = txtNote.Text.Trim();
- try
- {
- // update UDC!
- fatto = MagClass.magazzino.Udc_B48_FullUpdate(currUDC, ddlImballi.SelectedValue, noteTrim, MagClass.magazzino.CodSoggCurrUser);
- }
- catch
- { }
- if (fatto)
- {
- // lancio stampa
- MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartFinitiRxSP, Request.UserHostName);
- // registro creazione AL
- MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", string.Format("Stampato UDC Dtx RxFin {0} su linea {1}, note: {2} ", currUDC, Postazione.currCodLinea, noteTrim));
- Postazione.CssClass = cssAtt;
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("cartAlStampato");
- // calcolo particolare completo di descrizione
- DS_Applicazione.ElencoCartelliniRow riga = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0];
- string particolare = string.Format("{0} - {1}", riga.Particolare, riga.DescParticolare);
- // resetto...
- grViewDest.SelectedIndex = -1;
- qta = 0;
- currUDC = "";
- }
- doUpdate();
- }
- else
- {
- // ricarico che mi manca postazione!
- Postazione.CssClass = cssAtt;
- Postazione.warningText = traduci("ERR-POS-001");
- Postazione.messaggiText = "";
- Response.Redirect(user_std.pagCorrente);
- }
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// preseleziono (se possibile) imballo...
- ///
- ///
- ///
- protected void ddlImballi_DataBound(object sender, EventArgs e)
- {
- selezionaImballo();
- }
- ///
- /// seleziona imballo corretto
- ///
- private void selezionaImballo()
- {
- string codImb = "";
- // cerco se c'è un imballo x particolare corrente...
- if (currParticolare != "")
- {
- codImb = lastCodImb;
- }
- else
- {
- codImb = memLayer.ML.cdv("CodImballoFiniti");
- }
- try
- {
- // preseleziono
- ddlImballi.SelectedValue = codImb;
- }
- catch
- { }
- }
+ get
+ {
+ return memLayer.ML.cdvi("QtaImballoRXFin");
+ }
}
+
+
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
+ {
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+
+ ///
+ /// flusso associato (hard coded) ad ancestor TT (Trattati)
+ ///
+ protected string flussoAnc = "TT";
+ ///
+ /// flusso associato (hard coded) a temporaneo TL (Trattati/Liquidi)
+ ///
+ protected string flussoTemp = "TL";
+ ///
+ /// stato associato (hard coded) a UDC in IN: Trattato da travaso AL
+ ///
+ protected string statoUdcIn = "Tratt";
+ ///
+ /// codice evento dell'UDC temporaneo (IN) che si crea
+ ///
+ protected string codEventoUdcIn = "UDC_TRATT";
+
+ protected string cssOk = "stileComandoOk";
+ protected string cssErr = "stileComandoKo";
+ protected string cssWait = "stileComandoND";
+ protected string cssAtt = "stileAttesa";
+ protected string cssWarn = "stileComandoWarn";
+ protected string cssAdd = "stileComandoAdd";
+ public event EventHandler eh_reqUpdate;
+
+ ///
+ /// ultimo valore barcode letto (x confronto conferme doppio input...)
+ ///
+ protected string lastBarcodeIn
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("lastBCode_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("lastBCode_{0}", uid), value, false);
+ }
+ }
+ ///
+ /// Codice AL della cella corrente
+ ///
+ protected string destAL
+ {
+ get
+ {
+ return lblDestAL.Text.Trim();
+ }
+ set
+ {
+ lblDestAL.Text = value;
+ }
+ }
+ ///
+ /// Codice AL associato alla cella corrente...
+ ///
+ protected string AlByCella
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = string.Format("ALF00{0}", Postazione.currCodCella);
+ // controllo se esista AL sennò lo creo...
+ if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
+ {
+ MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// 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"));
+ }
+ }
+ ///
+ /// indica UDC correntemente selezionato
+ ///
+ protected string currUDC
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC di uguale particolare e stato fatto...
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStatoConImb(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUdcOut)[0].Qta;
+ }
+ catch
+ {
+ answ = memLayer.ML.cdvi("QtaImballoFiniti");
+ }
+ return answ;
+ }
+ }
+ ///
+ /// cod imballo dell'ultimo UDC del particolare generato
+ ///
+ public string lastCodImb
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStatoConImb(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUdcOut)[0].CodImballo;
+ }
+ catch
+ {
+ answ = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ return answ;
+ }
+ }
+ ///
+ /// 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();
+ }
+ }
+ ///
+ /// 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)
+ {
+ answ = DataMatrix_mgr.taDtxAcquisiti.getByKey(barcodeIn)[0].Particolare; // Decode.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;
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ qta = 0;
+ currUDC = "";
+ forceDelete = false;
+ setDefaultVal();
+ checkNumKeyIn();
+ }
+ setVisibility(!Page.IsPostBack);
+ checkBarcode();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// imposta i valori di default ad avvio
+ ///
+ private void setDefaultVal()
+ {
+ destAL = AlByCella;
+ }
+ ///
+ /// sistema modalità input
+ ///
+ /// forza reload imballo?
+ private void setVisibility(bool forceReloadImb)
+ {
+ bool showBtn = false;
+ // controllo btn quantità
+ if (grViewDest.SelectedIndex >= 0)
+ {
+ showBtn = true;
+ }
+ divQta.Visible = showBtn;
+ divImballi.Visible = showBtn;
+ if (showBtn && forceReloadImb)
+ {
+ selezionaImballo();
+ }
+ }
+ ///
+ /// reset maschera...
+ ///
+ protected void doReset()
+ {
+ // resetta
+ lastBarcodeIn = "";
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ Postazione.CssClass = cssAtt;
+ doUpdate();
+ }
+ ///
+ /// Verifica l'AL se sia ok x procedere:
+ /// - Attivo
+ ///
+ ///
+ /// T/L
+ ///
+ protected bool checkAL(string AL, string tipo)
+ {
+ bool answ = false;
+ try
+ {
+ answ = MagClass.magazzino.taEA.getByAL_TipoAttivo(AL, tipo).Rows.Count > 0;
+ }
+ catch
+ { }
+ if (answ)
+ {
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ }
+ else
+ {
+ Postazione.warningText = traduci("ErroreAlNonTtAttivo");
+ Postazione.CssClass = "stileComandoKo";
+ }
+
+ return answ;
+ }
+ ///
+ /// Verifica l'AL se abbia datamatrix
+ ///
+ ///
+ ///
+ protected bool checkDtxAL(string AL)
+ {
+ bool answ = false;
+ try
+ {
+ answ = DataMatrix_mgr.taDtx2UDC.getByAL(AL).Rows.Count > 0;
+ }
+ catch
+ { }
+ if (!answ)
+ {
+ Postazione.warningText = traduci("ErroreAlNonDtx");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ }
+ return answ;
+ }
+ ///
+ /// controlla se ci sia un barcode e cosa farne...
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
+ tipoCodiceBarcode tipoBC = MagClass.tipoBCode_L5(barcodeIn);
+ switch (tipoBC)
+ {
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ case tipoCodiceBarcode.Imballo:
+ // cerco di selezionare!
+ try
+ {
+ ddlImballi.SelectedValue = barcodeIn;
+ }
+ catch
+ {
+ Postazione.warningText = traduci("ERR-IMB-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ break;
+ case tipoCodiceBarcode.Comando:
+ // se è reset cancello tutto!
+ if (barcodeIn == memLayer.ML.cdv("cmdReset"))
+ {
+ doReset();
+ }
+ break;
+ case tipoCodiceBarcode.UDC:
+ // controllo di avere destAL valido, sennò ricarico pagina...
+ if (destAL.Length > 5)
+ {
+ // controllo se sia un UDC valido...
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // controllo se sia un UDC di finiti LIQ in posizione 4...
+ DS_magazzino.ElencoCartelliniRow cartUDC = MagClass.magazzino.taCartellini.getByUdc(barcodeIn)[0];
+ if (cartUDC.CodStato == statoUdcOut && cartUDC.IdxPosizione == memLayer.ML.cdvi("IdxPosizioneFiniti"))
+ {
+ // controllo NON ci sia già un UDC di pari particolare caricato nella postazione corrente (non posso avere 2 UDC a pari particolare da riempire...)
+ if (MagClass.magazzino.taCartellini.getByParticolareAL(cartUDC.Particolare, destAL).Rows.Count == 0)
+ {
+ // controllo NON sia UDC in LDP e già PRELEVATO
+ if (MagClass.magazzino.taRigheListePrelievo.getByUdc(barcodeIn).Select("Prelevato = 1").Length == 0)
+ {
+ // controllo NON abbia blocco x FinDtx...
+ if (MagClass.magazzino.udcHasAttr(barcodeIn, "BL"))
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-006");
+ Postazione.CssClass = cssErr;
+ }
+ else
+ {
+ // se è ok RICARICO UDC in posizione corrente...
+ bool fatto = MagClass.magazzino.finRxRiprendiInCaricoUDC(barcodeIn, MagClass.magazzino.CodSoggCurrUser, destAL, Postazione.currIdxCella);
+ if (fatto)
+ {
+ Postazione.messaggiText = traduci("RiCaricatoUdcLiq");
+ Postazione.warningText = "";
+ Postazione.CssClass = cssOk;
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-001");
+ Postazione.CssClass = cssErr;
+ }
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-005");
+ Postazione.CssClass = cssErr;
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-004");
+ Postazione.CssClass = cssErr;
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-002");
+ Postazione.CssClass = cssErr;
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-LIQ-003");
+ Postazione.CssClass = cssErr;
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-ALF-001");
+ Postazione.CssClass = cssErr;
+ }
+ break;
+ case tipoCodiceBarcode.DataMatrixTrovato:
+ // ciclo controllo x B48
+ string NewUDC = "";
+ // verifica preliminare: se Dtx OK procedo, se è KO NON LO CONSIDERO PROPRIO
+ bool isOk = false;
+ // controllo anche NC
+ bool isOkNc = false;
+ // controllo sia libero (= non assegnato)
+ bool isFree = false;
+ try
+ {
+ isOk = DataMatrix_mgr.taVerifica.GetData(barcodeIn)[0].StatoDtx == "OK";
+ }
+ catch
+ { }
+ try
+ {
+ isOkNc = DataMatrix_mgr.taAtt2Dtx.getByDtx(barcodeIn).Select("CodAttr = 'XF'").Length == 0;
+ }
+ catch
+ { }
+ try
+ {
+ isFree = DataMatrix_mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0;
+ }
+ catch
+ { }
+ // controlli x procedere
+ if (!isOkNc && !chkDtxMode.Checked)
+ {
+ // non accetto Dtx e mostro errore
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-016");
+ Postazione.CssClass = cssErr;
+ }
+ else if (!isOk && !chkDtxMode.Checked)
+ {
+ // non accetto Dtx e mostro errore
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-012");
+ Postazione.CssClass = cssErr;
+ }
+ else if (!isFree && !chkDtxMode.Checked)
+ {
+ // non accetto Dtx e mostro errore
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-017");
+ Postazione.CssClass = cssErr;
+ }
+ else if (isFree && chkDtxMode.Checked)
+ {
+ // non accetto Dtx e mostro errore
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-018");
+ Postazione.CssClass = cssErr;
+ }
+ else // PROCEDO!!!
+ {
+
+ // 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
+ {
+ // calcolo particolare + UDC dest
+ try
+ {
+ currParticolare = partByDtmx(true);
+ // se non ho UDC lo creo...
+ checkCreaUDC();
+ // verifico se ho UDC...
+ NewUDC = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in decodifica particolare da DataMatrix:{0}dtx:{1}{0}Eccezione:{0}{2}", Environment.NewLine, barcodeIn, exc), tipoLog.EXCEPTION);
+ NewUDC = "";
+ }
+ // ora proseguo...
+ if (currParticolare != "" && NewUDC != "")
+ {
+ // chiamo procedure aggiunta/rimozione secondo caso di selezione ADD/REM Dtx
+ if (!chkDtxMode.Checked)
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("DtxAdd"), barcodeIn);
+ Postazione.CssClass = "stileComandoOk";
+ procDtx_add(ref NewUDC);
+ }
+ // modalità "rimozione" datamatrix
+ else
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("DtxRem"), barcodeIn);
+ Postazione.CssClass = "stileComandoWarn";
+ procDtx_rem(ref NewUDC);
+ }
+ }
+ }
+ }
+ }
+ break;
+ default:
+ Postazione.warningText = traduci("ERR-BCD-001");
+ Postazione.CssClass = cssErr;
+ break;
+ }
+ barcodeIn = "";
+ }
+ doUpdate();
+ }
+
+ ///
+ /// 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("IdxPosizioneRxFinTemp"), 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, statoUdcOut, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), "IdxPosizioneRxFinTemp", codEventoUdcOut, noteTrim, "", adesso.Year, Request.UserHostName);
+ // lo associo all'AL...
+ MagClass.magazzino.taAL2UDC.Insert(destAL, newUdcChild, adesso, MagClass.magazzino.CodSoggCurrUser);
+
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in creazione UDC temp RX Fin: {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");
+ doUpdate();
+ }
+ }
+
+ #region metodi processing DataMatrix letto da BarCode
+
+ ///
+ /// processa aggiunta datamatrix (SE POSSIBILE)
+ ///
+ ///
+ private void procDtx_add(ref string NewUDC)
+ {
+ // genera eventuale UDC del particolare su cella/posizione corrente
+ qta = 1; // tanto poi si ricalcola...
+ checkCreaUDC();
+ // controllo che il DTX non sia già assegnato...
+ if (DataMatrix_mgr.taDtx2UDC.getByDtx(barcodeIn).Rows.Count == 0)
+ {
+ // verifico NON CI SIANO attributi DC pendenti (nel qual caso memorizzo primo comando e poi chiedo conferma... !!!FARE!!!
+ bool hasXQ = false;
+ if (DataMatrix_mgr.taAtt2Dtx.getByDtx(barcodeIn).Rows.Count > 0)
+ {
+ // cerco se abbia "XQ"...
+ if (DataMatrix_mgr.taAtt2Dtx.getByDtx(barcodeIn).Select("CodAttr = 'XQ'").Length > 0)
+ {
+ hasXQ = true;
+ }
+ }
+ if (hasXQ)
+ {
+ // verifico se c'è già in sessione la lettura di questo DataMatrix...
+ if (memLayer.ML.StringSessionObj("prevDmtx") == barcodeIn)
+ {
+ // è seconda lettura: allora procedo
+ hasXQ = false;
+ // svuoto da sessione
+ memLayer.ML.emptySessionVal("prevDmtx");
+ }
+ }
+ // se non ho pendenze...
+ if (!hasXQ)
+ {
+ // chiamo la stored che associa Dtx a UDC
+ DataMatrix_mgr.taDtx2UDC.RxSetDtx2Udc(barcodeIn, MagClass.magazzino.CodSoggCurrUser, statoUdcOut, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), Postazione.currIdxCella);
+ }
+ else
+ {
+ // mostro messaggio che chiede seconda lettura conferma e salvo in sessione...
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("B48_ReadTwiceToConfirm");
+ Postazione.CssClass = "stileComandoWarn";
+ // salvo in sessione dmtx x conferma
+ memLayer.ML.setSessionVal("prevDmtx", barcodeIn);
+ }
+ }
+ }
+ ///
+ /// processa rimozione datamatrix (se possibile)
+ ///
+ ///
+ private void procDtx_rem(ref string NewUDC)
+ {
+ // verifico sia nell'UDC dest
+ if (DataMatrix_mgr.taDtx2UDC.getByDtxAl(destAL, barcodeIn).Rows.Count != 0)
+ {
+ // rimuovo Dtx
+ DataMatrix_mgr.taDtx2UDC.deleteQuery(DataMatrix_mgr.taDtx2UDC.getByDtxAl(destAL, barcodeIn)[0].UDC, barcodeIn, MagClass.magazzino.CodSoggCurrUser, memLayer.ML.cdvi("IdxPosizioneRxFinTemp"), Postazione.currIdxCella);
+ // assegno Attributo x indicare che è stato rimosso...
+ DataMatrix_mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XQ", "Rim. UDC B48", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ }
+ }
+
+ #endregion
+
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ setDefaultVal();
+ setVisibility(!Page.IsPostBack);
+ grViewDest.DataBind();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ verificaBtnStampa();
+ txtBarcode.Focus();
+ }
+ ///
+ /// evento selezione grView destinazione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // ricarico dati dell'UDC come particolare e quantità...
+ currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
+ int qtaDtx = 0;
+ if (MagClass.magazzino.checkUDC(currUDC))
+ {
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
+ qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
+ qtaDtx = Convert.ToInt32(MagClass.magazzino.taA2U2D.getByUDC(currUDC)[0].QtaDtx);
+ // imposto particolare...
+ lblPart.Text = currParticolare;
+ ddlImballi.DataBind();
+ }
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ setVisibility(true);
+ doUpdate();
+ // fisso focus su note!
+ txtNote.Focus();
+ }
+ ///
+ /// prende in carico AL selezionato
+ ///
+ ///
+ ///
+ protected void lbtPrendeCaricoAL_Click(object sender, EventArgs e)
+ {
+ doUpdate();
+ }
+ ///
+ /// variabile force delete salvata...
+ ///
+ protected bool forceDelete
+ {
+ get
+ {
+ return memLayer.ML.BoolSessionObj(string.Format("ForceDelAL_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("ForceDelAL_{0}", uid), value);
+ }
+ }
+ ///
+ /// Verifica se Assieme sia vuoto (no DTX negli UDC)
+ ///
+ /// Codice AL
+ ///
+ protected bool assiemeIsEmpty(string AL)
+ {
+ bool answ = false;
+ try
+ {
+ answ = DataMatrix_mgr.taDtx2UDC.getByAL(AL).Rows.Count == 0;
+ }
+ catch { }
+ return answ;
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ grViewDest.SelectedIndex = -1;
+ qta = 0;
+ currUDC = "";
+ setVisibility(false);
+ doUpdate();
+ }
+ ///
+ /// update Qty x UDC selezionato...
+ ///
+ ///
+ ///
+ protected void lbtUpdQty_Click(object sender, EventArgs e)
+ {
+ MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", codEventoUdcOut, qta);
+ currUDC = "";
+ currParticolare = "";
+ grViewDest.SelectedIndex = -1;
+ doUpdate();
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ // registro ri-stampa UDC
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, "", "stampaUDC", string.Format("Ri-Stampato UDC Dtx {0} su linea {1}", currUDC, Postazione.currCodLinea));
+ }
+ ///
+ /// verifica visibilità btn stampa UDC
+ ///
+ private void verificaBtnStampa()
+ {
+ bool showBtnStampa = false;
+ // se ho selezionato udc...
+ if (currUDC != "")
+ {
+ DS_magazzino.v_A2U2DRow riga;
+ int qtaUDC = 0;
+ int qtaDtx = 0;
+ try
+ {
+ riga = MagClass.magazzino.taA2U2D.getByUDC(currUDC)[0];
+ qtaUDC = Convert.ToInt32(riga.Qta);
+ qtaDtx = riga.QtaDtx;
+ }
+ catch
+ { }
+ if (qtaUDC > 0 && (qtaUDC <= QtaImballoRXFin))
+ {
+ // se le qta voluta e dtx sono uguali...
+ if (qtaUDC == qtaDtx)
+ {
+ showBtnStampa = true;
+ }
+ }
+ }
+ divNote.Visible = showBtnStampa;
+ }
+ ///
+ /// fornisce in output la corretta classe css x icona
+ ///
+ ///
+ ///
+ ///
+ public string cssGlyphByQty(object _qta, object _qtaDtx)
+ {
+ string answ = "glyphicon glyphicon-pencil btn-lg";
+ int qtaUDC = 0;
+ int qtaDtx = -1;
+ try
+ {
+ qtaUDC = Convert.ToInt32(_qta);
+ }
+ catch { }
+ try
+ {
+ qtaDtx = Convert.ToInt32(_qtaDtx);
+ }
+ catch { }
+ if ((qtaUDC == qtaDtx) && (qtaUDC == QtaImballoRXFin))
+ {
+ answ = "glyphicon glyphicon-print btn-lg";
+ }
+ return answ;
+ }
+ ///
+ /// effettua processo di sistemazione UDC e stampa
+ ///
+ ///
+ ///
+ protected void lbtStampaUDC_Click(object sender, EventArgs e)
+ {
+ // verifico postazione sia valida...
+ if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
+ {
+ // fa le operazioni di update x UDC e poi lo stampa
+ bool fatto = false;
+ string noteTrim = txtNote.Text.Trim();
+ try
+ {
+ // update UDC!
+ fatto = MagClass.magazzino.Udc_B48_FullUpdate(currUDC, ddlImballi.SelectedValue, noteTrim, MagClass.magazzino.CodSoggCurrUser);
+ }
+ catch
+ { }
+ if (fatto)
+ {
+ // lancio stampa
+ MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartFinitiRxSP, Request.UserHostName);
+ // registro creazione AL
+ MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", string.Format("Stampato UDC Dtx RxFin {0} su linea {1}, note: {2} ", currUDC, Postazione.currCodLinea, noteTrim));
+ Postazione.CssClass = cssAtt;
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("cartAlStampato");
+ // calcolo particolare completo di descrizione
+ DS_Applicazione.ElencoCartelliniRow riga = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0];
+ string particolare = string.Format("{0} - {1}", riga.Particolare, riga.DescParticolare);
+ // resetto...
+ grViewDest.SelectedIndex = -1;
+ qta = 0;
+ currUDC = "";
+ }
+ doUpdate();
+ }
+ else
+ {
+ // ricarico che mi manca postazione!
+ Postazione.CssClass = cssAtt;
+ Postazione.warningText = traduci("ERR-POS-001");
+ Postazione.messaggiText = "";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// preseleziono (se possibile) imballo...
+ ///
+ ///
+ ///
+ protected void ddlImballi_DataBound(object sender, EventArgs e)
+ {
+ selezionaImballo();
+ }
+ ///
+ /// seleziona imballo corretto
+ ///
+ private void selezionaImballo()
+ {
+ string codImb = "";
+ // cerco se c'è un imballo x particolare corrente...
+ if (currParticolare != "")
+ {
+ codImb = lastCodImb;
+ }
+ else
+ {
+ codImb = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ try
+ {
+ // preseleziono
+ ddlImballi.SelectedValue = codImb;
+ }
+ catch
+ { }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_recAttributiDtx.ascx.cs b/GMW/WebUserControls/mod_recAttributiDtx.ascx.cs
index 7bb6cb13..83172460 100644
--- a/GMW/WebUserControls/mod_recAttributiDtx.ascx.cs
+++ b/GMW/WebUserControls/mod_recAttributiDtx.ascx.cs
@@ -5,207 +5,211 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_recAttributiDtx : System.Web.UI.UserControl
+ public partial class mod_recAttributiDtx : System.Web.UI.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// Avvio pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
{
- public event EventHandler eh_reqUpdate;
- ///
- /// Avvio pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- resetIN();
- }
- checkBarcode();
- }
- ///
- /// restta input
- ///
- private void resetIN()
- {
- AddAttr = true;
- lblCodAttr.Text = currAttr;
- }
- ///
- /// Aggiungi/Rimuovi attributo
- ///
- public bool AddAttr
- {
- get
- {
- return chkAdd.Checked;
- }
- set
- {
- chkAdd.Checked = value;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// tipologia di attributo registrato con DataMatrix
- ///
- public tipoAttrDtx tipologia { get; set; }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
- switch (MagClass.tipoBCode_L5(barcodeIn))
- {
- case tipoCodiceBarcode.DataMatrixTrovato:
- // recupero da UDC
- try
- {
- // se si tratta di prove distruttive registrando attributi si fa update di UDC e link...
- DataMatrix.mgr.taAtt2Dtx.insertAndProc(barcodeIn, AddAttr, currAttr, tipologia.ToString(), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- if (AddAttr)
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("RegistratoAttributo"), tipologia);
- }
- else
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("EliminatoAttributo"), tipologia);
- }
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- catch
- {
- Postazione.warningText = traduci("ERR-A2D-001");
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Comando:
- // se è reset cancello tutto!
- if (barcodeIn == memLayer.ML.cdv("cmdReset"))
- {
- resetIN();
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- doUpdate();
- }
- Postazione.CssClass = "stileAttesa";
- break;
- default:
- Postazione.messaggiText = "";
- Postazione.warningText = traduci("ERR-UNK-001");
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- else
- {
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- }
- doUpdate();
- }
- ///
- /// modificato attributo registra/elimina attributo
- ///
- ///
- ///
- protected void chkAdd_CheckedChanged(object sender, EventArgs e)
- {
- doUpdate();
- }
- ///
- /// aggiorna componenti + focus a barcode
- ///
- public void doUpdate()
- {
- if (AddAttr)
- {
- chkAdd.Text = traduci("AggiungiAttr");
- lblAdd.Attributes.Remove("class");
- lblAdd.Attributes.Add("class", "btn btn-warning");
- }
- else
- {
- chkAdd.Text = traduci("TogliAttr");
- lblAdd.Attributes.Remove("class");
- lblAdd.Attributes.Add("class", "btn btn-danger");
- }
- grView.DataBind();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- txtBarcode.Focus();
- }
- ///
- /// codice attributo corrente da tipologia attributi controllo (hard coded)
- ///
- public string currAttr
- {
- get
- {
- string answ = "";
- switch (tipologia)
- {
- case tipoAttrDtx.ExtraCiclo:
- answ = "EC";
- break;
- case tipoAttrDtx.ProveDimensionali:
- answ = "PD";
- break;
- case tipoAttrDtx.ProveDistruttive:
- answ = "DI";
- break;
- default:
- answ = "";
- break;
- }
- return answ;
- }
- }
+ if (!Page.IsPostBack)
+ {
+ resetIN();
+ }
+ checkBarcode();
}
+ ///
+ /// restta input
+ ///
+ private void resetIN()
+ {
+ AddAttr = true;
+ lblCodAttr.Text = currAttr;
+ }
+ ///
+ /// Aggiungi/Rimuovi attributo
+ ///
+ public bool AddAttr
+ {
+ get
+ {
+ return chkAdd.Checked;
+ }
+ set
+ {
+ chkAdd.Checked = value;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// tipologia di attributo registrato con DataMatrix
+ ///
+ public tipoAttrDtx tipologia { get; set; }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
+ switch (MagClass.tipoBCode_L5(barcodeIn))
+ {
+ case tipoCodiceBarcode.DataMatrixTrovato:
+ // recupero da UDC
+ try
+ {
+ // se si tratta di prove distruttive registrando attributi si fa update di UDC e link...
+ DataMatrix_mgr.taAtt2Dtx.insertAndProc(barcodeIn, AddAttr, currAttr, tipologia.ToString(), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ if (AddAttr)
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("RegistratoAttributo"), tipologia);
+ }
+ else
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("EliminatoAttributo"), tipologia);
+ }
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ }
+ catch
+ {
+ Postazione.warningText = traduci("ERR-A2D-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ break;
+ case tipoCodiceBarcode.Comando:
+ // se è reset cancello tutto!
+ if (barcodeIn == memLayer.ML.cdv("cmdReset"))
+ {
+ resetIN();
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ doUpdate();
+ }
+ Postazione.CssClass = "stileAttesa";
+ break;
+ default:
+ Postazione.messaggiText = "";
+ Postazione.warningText = traduci("ERR-UNK-001");
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ doUpdate();
+ }
+ ///
+ /// modificato attributo registra/elimina attributo
+ ///
+ ///
+ ///
+ protected void chkAdd_CheckedChanged(object sender, EventArgs e)
+ {
+ doUpdate();
+ }
+ ///
+ /// aggiorna componenti + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ if (AddAttr)
+ {
+ chkAdd.Text = traduci("AggiungiAttr");
+ lblAdd.Attributes.Remove("class");
+ lblAdd.Attributes.Add("class", "btn btn-warning");
+ }
+ else
+ {
+ chkAdd.Text = traduci("TogliAttr");
+ lblAdd.Attributes.Remove("class");
+ lblAdd.Attributes.Add("class", "btn btn-danger");
+ }
+ grView.DataBind();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ txtBarcode.Focus();
+ }
+ ///
+ /// codice attributo corrente da tipologia attributi controllo (hard coded)
+ ///
+ public string currAttr
+ {
+ get
+ {
+ string answ = "";
+ switch (tipologia)
+ {
+ case tipoAttrDtx.ExtraCiclo:
+ answ = "EC";
+ break;
+ case tipoAttrDtx.ProveDimensionali:
+ answ = "PD";
+ break;
+ case tipoAttrDtx.ProveDistruttive:
+ answ = "DI";
+ break;
+ default:
+ answ = "";
+ break;
+ }
+ return answ;
+ }
+ }
+ }
}
///
/// Tipologia attributi legati a DTX ammessi/Gestiti
///
public enum tipoAttrDtx
{
- ///
- /// Gestione ExtraCiclo
- ///
- ExtraCiclo,
- ///
- /// Gestione prove dimensionali
- ///
- ProveDimensionali,
- ///
- /// Gestione prove distruttive
- ///
- ProveDistruttive
+ ///
+ /// Gestione ExtraCiclo
+ ///
+ ExtraCiclo,
+ ///
+ /// Gestione prove dimensionali
+ ///
+ ProveDimensionali,
+ ///
+ /// Gestione prove distruttive
+ ///
+ ProveDistruttive
}
diff --git a/GMW/WebUserControls/mod_setAttrDtx.ascx.cs b/GMW/WebUserControls/mod_setAttrDtx.ascx.cs
index 64c8624a..353cda49 100644
--- a/GMW/WebUserControls/mod_setAttrDtx.ascx.cs
+++ b/GMW/WebUserControls/mod_setAttrDtx.ascx.cs
@@ -5,325 +5,330 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_setAttrDtx : System.Web.UI.UserControl
- { ///
- /// flusso associato (hard coded) a sterrati
- ///
- protected string flusso = "ST";
- ///
- /// stato associato (hard coded) a sterrati
- ///
- protected string statoUDC = "Sterr";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_SBFUS";
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ public partial class mod_setAttrDtx : System.Web.UI.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// flusso associato (hard coded) a sterrati
+ ///
+ protected string flusso = "ST";
+ ///
+ /// stato associato (hard coded) a sterrati
+ ///
+ protected string statoUDC = "Sterr";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_SBFUS";
+ 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)
+ {
+ traduciObj();
+ divBlocca.Visible = false;
+ idxCella = Postazione.currIdxCella;
+ }
+ doChecks();
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaST"))
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaST");
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaST", value);
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ protected string PagCorrente
+ {
+ get
+ {
+ string answ = "";
+ Uri MyUrl = Request.Url;
+ string delimStr = "/";
+ char[] delimiter = delimStr.ToCharArray();
+ string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
+ int n = finalUrl.Length;
+ answ = finalUrl[n - 1].ToString();
+ DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
+ answ = riga.NOME;
+ return answ;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// 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"));
+ }
+ }
+ ///
+ /// indica UDC correntemente selezionato
+ ///
+ protected string currUDC
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// Formato Datamatrix della linea selezionata
+ ///
+ protected string FormatoDtmxLinea
+ {
+ get
+ {
+ return ddlFormDmtx.SelectedValue;
+ }
+ }
+ ///
+ /// Formato Datamatrix dell'ultimo barcode letto
+ ///
+ protected string FormatoDtmxBarcode
+ {
+ get
+ {
+ string answ = "";
+ try
{
- if (!Page.IsPostBack)
- {
- traduciObj();
- divBlocca.Visible = false;
- idxCella = Postazione.currIdxCella;
- }
- doChecks();
+ answ = DataMatrix_mgr.taVerifica.GetData(barcodeIn)[0].FormatoDtmx;
}
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ tipoCodiceBarcode tipoBC = MagClass.tipoBCode_L5(barcodeIn);
+ switch (tipoBC)
{
- get
+ case tipoCodiceBarcode.DataMatrixTrovato:
+ // verifico formato datamatrix letto sia quello della linea...
+ if (FormatoDtmxBarcode != FormatoDtmxLinea)
{
- int answ = 0;
- if (memLayer.ML.isInSessionObject("IdxCellaLineaST"))
- {
- answ = memLayer.ML.IntSessionObj("IdxCellaLineaST");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("IdxCellaLineaST", value);
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- protected string PagCorrente
- {
- get
- {
- string answ = "";
- Uri MyUrl = Request.Url;
- string delimStr = "/";
- char[] delimiter = delimStr.ToCharArray();
- string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
- int n = finalUrl.Length;
- answ = finalUrl[n - 1].ToString();
- DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
- answ = riga.NOME;
- return answ;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// 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"));
- }
- }
- ///
- /// indica UDC correntemente selezionato
- ///
- protected string currUDC
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// Formato Datamatrix della linea selezionata
- ///
- protected string FormatoDtmxLinea
- {
- get
- {
- return ddlFormDmtx.SelectedValue;
- }
- }
- ///
- /// Formato Datamatrix dell'ultimo barcode letto
- ///
- protected string FormatoDtmxBarcode
- {
- get
- {
- string answ = "";
- try
- {
- answ = DataMatrix.mgr.taVerifica.GetData(barcodeIn)[0].FormatoDtmx;
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- tipoCodiceBarcode tipoBC = MagClass.tipoBCode_L5(barcodeIn);
- switch (tipoBC)
- {
- case tipoCodiceBarcode.DataMatrixTrovato:
- // 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
- {
-
- Postazione.messaggiText = string.Format("{0} {1} su dtx TROVATO {2}", traduci("AssegnatoAttr"), ddlTipoAttr.SelectedValue, barcodeIn);
- Postazione.CssClass = "stileComandoOk";
- // assegno attributo!
- DataMatrix.mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", string.Format("Assegnazione Attr {0} su Dtmx TROVATO tipo {1}", ddlTipoAttr.SelectedValue, ddlFormDmtx.SelectedValue), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- grView.DataBind();
- }
- break;
- case tipoCodiceBarcode.DataMatrixDecodificato:
- // 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
- {
-
- Postazione.messaggiText = string.Format("{0} {1} su dtx DECODIFICATO {2}", traduci("AssegnatoAttr"), ddlTipoAttr.SelectedValue, barcodeIn);
- Postazione.CssClass = "stileComandoOk";
- // assegno attributo!
- DataMatrix.mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", string.Format("Assegnazione Attr {0} su Dtmx DECODIFICATO tipo {1}", ddlTipoAttr.SelectedValue, ddlFormDmtx.SelectedValue), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- grView.DataBind();
- }
- break;
- default:
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- divBlocca.Visible = false;
- break;
- }
- barcodeIn = "";
+ // errore corrispondenza formato Dtmx
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-014");
+ Postazione.CssClass = "stileComandoKo";
}
else
{
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- }
- txtBarcode.Focus();
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- grView.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
+ Postazione.messaggiText = string.Format("{0} {1} su dtx TROVATO {2}", traduci("AssegnatoAttr"), ddlTipoAttr.SelectedValue, barcodeIn);
+ Postazione.CssClass = "stileComandoOk";
+ // assegno attributo!
+ DataMatrix_mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", string.Format("Assegnazione Attr {0} su Dtmx TROVATO tipo {1}", ddlTipoAttr.SelectedValue, ddlFormDmtx.SelectedValue), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ grView.DataBind();
+ }
+ break;
+ case tipoCodiceBarcode.DataMatrixDecodificato:
+ // verifico formato datamatrix letto sia quello della linea...
+ if (FormatoDtmxBarcode != FormatoDtmxLinea)
{
- eh_reqUpdate(this, new EventArgs());
+ // errore corrispondenza formato Dtmx
+ Postazione.messaggiText = barcodeIn;
+ Postazione.warningText = traduci("ERR-DTX-014");
+ Postazione.CssClass = "stileComandoKo";
}
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- currParticolare = "";
- doChecks();
- }
+ else
+ {
- protected void grView_PageIndexChanged(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- protected void grView_Sorted(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
-
-
- ///
- /// sblocca UDC
- ///
- ///
- ///
- protected void BloccaUDC_Click(object sender, EventArgs e)
- {
- // va cancellata la sua relazioni Fuso-Sterrato e va spostato in locazione Fusi Terra
- DataMatrix.mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", "NC FUS B48", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // resetto selezione
+ Postazione.messaggiText = string.Format("{0} {1} su dtx DECODIFICATO {2}", traduci("AssegnatoAttr"), ddlTipoAttr.SelectedValue, barcodeIn);
+ Postazione.CssClass = "stileComandoOk";
+ // assegno attributo!
+ DataMatrix_mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", string.Format("Assegnazione Attr {0} su Dtmx DECODIFICATO tipo {1}", ddlTipoAttr.SelectedValue, ddlFormDmtx.SelectedValue), DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ grView.DataBind();
+ }
+ break;
+ default:
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
divBlocca.Visible = false;
- currUDC = "";
- currParticolare = "";
- doUpdate();
- }
-
- protected void ddlFormDmtx_SelectedIndexChanged(object sender, EventArgs e)
- {
- checkFixOds();
- }
-
- protected void ddlTipoAttr_SelectedIndexChanged(object sender, EventArgs e)
- {
- checkFixOds();
+ break;
}
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ txtBarcode.Focus();
}
+
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ grView.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ currParticolare = "";
+ doChecks();
+ }
+
+ protected void grView_PageIndexChanged(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ protected void grView_Sorted(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+
+
+ ///
+ /// sblocca UDC
+ ///
+ ///
+ ///
+ protected void BloccaUDC_Click(object sender, EventArgs e)
+ {
+ // va cancellata la sua relazioni Fuso-Sterrato e va spostato in locazione Fusi Terra
+ DataMatrix_mgr.taAtt2Dtx.insertAndProc(barcodeIn, true, "XF", "NC FUS B48", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // resetto selezione
+ divBlocca.Visible = false;
+ currUDC = "";
+ currParticolare = "";
+ doUpdate();
+ }
+
+ protected void ddlFormDmtx_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ checkFixOds();
+ }
+
+ protected void ddlTipoAttr_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ checkFixOds();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_specDmtx.ascx.cs b/GMW/WebUserControls/mod_specDmtx.ascx.cs
index 0a182935..9bf5da9e 100644
--- a/GMW/WebUserControls/mod_specDmtx.ascx.cs
+++ b/GMW/WebUserControls/mod_specDmtx.ascx.cs
@@ -7,158 +7,162 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_specDmtx : ApplicationUserControl
+ public partial class mod_specDmtx : ApplicationUserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
{
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- resetSelezione();
- }
- ///
- /// resetta la selezione dei valori in caso di modifiche su altri controlli
- ///
- public void resetSelezione()
- {
- grView.SelectedIndex = -1;
- grView.DataBind();
- raiseEvent(ucEvType.Reset);
- }
- ///
- /// inserisce nuovo valore da footer
- ///
- ///
- ///
- protected void lblIns_click(object sender, EventArgs e)
- {
- // click su inserimento, chiamo il metodo insert dell'ObjectDataSource
- ods.Insert();
- }
- ///
- /// gestione evento richiesta nuovo valore (mostra footer, ...)
- ///
- ///
- ///
- protected void btnNew_Click(object sender, EventArgs e)
- {
- // reset selezione...
- resetSelezione();
- // mostro il footer oppure la riga dei dettagli x nuovo...
- if (grView.FooterRow != null)
- {
- grView.FooterRow.Visible = true;
- }
- }
- ///
- /// determina se sia eliminabile il record (=non usato)
- ///
- ///
- ///
- public bool delEnabled(object idxObj)
- {
- bool answ = isWritable();
-
- return answ;
- }
-
- ///
- /// elenco colonne del datagrid
- ///
- ///
- protected DataColumnCollection colonneObj()
- {
- DS_DataMatrix.TabSpecDtxDataTable tabella = new DS_DataMatrix.TabSpecDtxDataTable();
- DataColumnCollection colonne = tabella.Columns;
- return colonne;
- }
- ///
- /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
- /// questi devono essere opportunamente nominati (es: txt{0}, dl{0}, ...)
- ///
- ///
- ///
- protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
- {
- //recupero la riga footer...
- DataColumnCollection colonne = colonneObj();
- string nomeCol;
- string tipoColonna = "";
- foreach (DataColumn colonna in colonne)
- {
- nomeCol = colonna.ColumnName;
- // cerco un textbox o quello che sia...
- if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
- {
- tipoColonna = "textBox";
- }
- else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
- {
- tipoColonna = "dropDownList";
- }
- else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
- {
- tipoColonna = "checkBox";
- }
- else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
- {
- tipoColonna = "selAjax";
- }
- // in base al tipo salvo negli inputparameters dell'ODS
- switch (tipoColonna)
- {
- case "textBox":
- e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
- break;
- case "dropDownList":
- e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
- break;
- case "checkBox":
- e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
- break;
- case "selAjax":
- e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
- break;
- default:
- break;
- }
- tipoColonna = "";
- }
- // imposto formato Dtmx
- e.InputParameters["FormatoDtmx"] = FormatoDtmx;
- if (e.InputParameters["ValoreStr"] == null) e.InputParameters["ValoreStr"] = "";
- }
-
- protected void grView_SelectedIndexChanged(object sender, EventArgs e)
- {
- raiseEvent(ucEvType.Selected);
- }
-
- public string FormatoDtmx
- {
- get
- {
- return hfFormatoDtmx.Value;
- }
- set
- {
- hfFormatoDtmx.Value = value;
- grView.SelectedIndex = -1;
- }
- }
-
- protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
- {
- if (e.InputParameters["ValoreStr"] == null) e.InputParameters["ValoreStr"] = "";
- }
-
- protected void btnNewFromEmpty_Click(object sender, EventArgs e)
- {
- // creo record x la lunghezza
- DataMatrix.mgr.taSpecDtmx.Insert(FormatoDtmx, "LUNGH", "", FormatoDtmx.Length, "", 0, true);
- grView.DataBind();
- }
+ resetSelezione();
}
+ ///
+ /// resetta la selezione dei valori in caso di modifiche su altri controlli
+ ///
+ public void resetSelezione()
+ {
+ grView.SelectedIndex = -1;
+ grView.DataBind();
+ raiseEvent(ucEvType.Reset);
+ }
+ ///
+ /// inserisce nuovo valore da footer
+ ///
+ ///
+ ///
+ protected void lblIns_click(object sender, EventArgs e)
+ {
+ // click su inserimento, chiamo il metodo insert dell'ObjectDataSource
+ ods.Insert();
+ }
+ ///
+ /// gestione evento richiesta nuovo valore (mostra footer, ...)
+ ///
+ ///
+ ///
+ protected void btnNew_Click(object sender, EventArgs e)
+ {
+ // reset selezione...
+ resetSelezione();
+ // mostro il footer oppure la riga dei dettagli x nuovo...
+ if (grView.FooterRow != null)
+ {
+ grView.FooterRow.Visible = true;
+ }
+ }
+ ///
+ /// determina se sia eliminabile il record (=non usato)
+ ///
+ ///
+ ///
+ public bool delEnabled(object idxObj)
+ {
+ bool answ = isWritable();
+
+ return answ;
+ }
+
+ ///
+ /// elenco colonne del datagrid
+ ///
+ ///
+ protected DataColumnCollection colonneObj()
+ {
+ DS_DataMatrix.TabSpecDtxDataTable tabella = new DS_DataMatrix.TabSpecDtxDataTable();
+ DataColumnCollection colonne = tabella.Columns;
+ return colonne;
+ }
+ ///
+ /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
+ /// questi devono essere opportunamente nominati (es: txt{0}, dl{0}, ...)
+ ///
+ ///
+ ///
+ protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ //recupero la riga footer...
+ DataColumnCollection colonne = colonneObj();
+ string nomeCol;
+ string tipoColonna = "";
+ foreach (DataColumn colonna in colonne)
+ {
+ nomeCol = colonna.ColumnName;
+ // cerco un textbox o quello che sia...
+ if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
+ {
+ tipoColonna = "textBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
+ {
+ tipoColonna = "dropDownList";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
+ {
+ tipoColonna = "checkBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
+ {
+ tipoColonna = "selAjax";
+ }
+ // in base al tipo salvo negli inputparameters dell'ODS
+ switch (tipoColonna)
+ {
+ case "textBox":
+ e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
+ break;
+ case "dropDownList":
+ e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
+ break;
+ case "checkBox":
+ e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
+ break;
+ case "selAjax":
+ e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
+ break;
+ default:
+ break;
+ }
+ tipoColonna = "";
+ }
+ // imposto formato Dtmx
+ e.InputParameters["FormatoDtmx"] = FormatoDtmx;
+ if (e.InputParameters["ValoreStr"] == null) e.InputParameters["ValoreStr"] = "";
+ }
+
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ raiseEvent(ucEvType.Selected);
+ }
+
+ public string FormatoDtmx
+ {
+ get
+ {
+ return hfFormatoDtmx.Value;
+ }
+ set
+ {
+ hfFormatoDtmx.Value = value;
+ grView.SelectedIndex = -1;
+ }
+ }
+
+ protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ if (e.InputParameters["ValoreStr"] == null) e.InputParameters["ValoreStr"] = "";
+ }
+
+ protected void btnNewFromEmpty_Click(object sender, EventArgs e)
+ {
+ // creo record x la lunghezza
+ DataMatrix_mgr.taSpecDtmx.Insert(FormatoDtmx, "LUNGH", "", FormatoDtmx.Length, "", 0, true);
+ grView.DataBind();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_spostaDataMatrix.ascx.cs b/GMW/WebUserControls/mod_spostaDataMatrix.ascx.cs
index 3130cd37..6dd374a4 100644
--- a/GMW/WebUserControls/mod_spostaDataMatrix.ascx.cs
+++ b/GMW/WebUserControls/mod_spostaDataMatrix.ascx.cs
@@ -5,344 +5,348 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_spostaDataMatrix : System.Web.UI.UserControl
+ public partial class mod_spostaDataMatrix : System.Web.UI.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// controlli al caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
{
- ///
- /// controlli al caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ // se primo caricamento resetto gitterbox...)
+ if (!Page.IsPostBack)
+ {
+ currGitterBox = "";
+ pnlAll.CssClass = "stileAttesa";
+ }
+ checkBarcode();
+ lblPezziGitterbox.Text = string.Format("{0} pz.", pezziGitterbox);
+ lblCurrentPage.Text = traduci(PagCorrente);
+ if (currGitterBox != "")
+ {
+ lblGitterBoxAttivo.Text = string.Format("Gitterbox selezionato {0}", currGitterBox);
+ }
+ else
+ {
+ lblGitterBoxAttivo.Text = "...";
+ }
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ protected string PagCorrente
+ {
+ get
+ {
+ string answ = "";
+ Uri MyUrl = Request.Url;
+ string delimStr = "/";
+ char[] delimiter = delimStr.ToCharArray();
+ string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
+ int n = finalUrl.Length;
+ answ = finalUrl[n - 1].ToString();
+ DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
+ answ = riga.NOME;
+ return answ;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// num pezzi del gitterbox
+ ///
+ public int pezziGitterbox
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- // se primo caricamento resetto gitterbox...)
- if (!Page.IsPostBack)
+ answ = (int)MagClass.magazzino.taCartellini.getByUdc(currGitterBox)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// indica il gitterbox correntemente selezionato
+ ///
+ protected string currGitterBox
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("currGitterBox");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("currGitterBox", value);
+ }
+ }
+ ///
+ /// controllo booleano sul gitterbox se sia ok x caricamento altri pezzi (ovvero en contiene meno del max consentito
+ ///
+ protected bool gitterboxOk
+ {
+ get
+ {
+ bool answ = false;
+ int maxPezzi = memLayer.ML.confReadInt("qtaOdette");
+ int numPezzi = maxPezzi;
+ try
+ {
+ numPezzi = (int)MagClass.magazzino.taCartellini.getByUdc(currGitterBox)[0].Qta;
+ }
+ catch
+ {
+ httpLog(string.Format("Non sono riuscito a trovare dati per il gitterbox {0}", currGitterBox), tipoLog.ERROR);
+ }
+ // controllo se il codice sia "Pieno", ovvero max pezzi
+ if (numPezzi < maxPezzi)
+ {
+ answ = true;
+ }
+ return answ;
+ }
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ string postazione_IP = "";
+ try
+ {
+ postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
+ }
+ catch
+ { }
+ logger.lg.scriviLog(postazione_IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ string postazione_IP = "";
+ try
+ {
+ postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
+ }
+ catch
+ { }
+ logger.lg.scriviLog(postazione_IP + testoLog, tipo);
+ return answ;
+ }
+
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ lblMessaggi.Text = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Gitterbox:
+ // imposto il gitterbox corrente
+ currGitterBox = barcodeIn;
+ if (gitterboxOk)
{
+ // controllo se il gitterbox non sia stato già associato ad una etichetta odette - non si può spostare
+ if (Odette.mgr.gitterboxInOdette(currGitterBox))
+ {
currGitterBox = "";
- pnlAll.CssClass = "stileAttesa";
+ lblMessaggi.Text += " - gitterbox associatoad odette!!! non impostabile.";
+ pnlAll.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ lblMessaggi.Text += " - impostato nuovo gitterbox di destinazione!";
+ pnlAll.CssClass = "stileComandoOk";
+ }
}
- checkBarcode();
- lblPezziGitterbox.Text = string.Format("{0} pz.", pezziGitterbox);
- lblCurrentPage.Text = traduci(PagCorrente);
+ else
+ {
+ lblMessaggi.Text += " - gitterbox pieno!!! impostato, ma non si possono versare altri pezzi.";
+ pnlAll.CssClass = "stileComandoKo";
+ }
+ break;
+ case tipoCodiceBarcode.DataMatrixTrovato:
+ // se c'è un gitterbox attivo sposto il datamatrix
if (currGitterBox != "")
{
- lblGitterBoxAttivo.Text = string.Format("Gitterbox selezionato {0}", currGitterBox);
- }
- else
- {
- lblGitterBoxAttivo.Text = "...";
- }
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- protected string PagCorrente
- {
- get
- {
- string answ = "";
- Uri MyUrl = Request.Url;
- string delimStr = "/";
- char[] delimiter = delimStr.ToCharArray();
- string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
- int n = finalUrl.Length;
- answ = finalUrl[n - 1].ToString();
- DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
- answ = riga.NOME;
- return answ;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// num pezzi del gitterbox
- ///
- public int pezziGitterbox
- {
- get
- {
- int answ = 0;
- try
+ if (gitterboxOk)
+ {
+ decimal dataMatrix = Convert.ToDecimal(barcodeIn);
+ // controllo che esissta il datamatrix...
+ if (Odette.mgr.datamatrixEsiste(dataMatrix))
{
- answ = (int)MagClass.magazzino.taCartellini.getByUdc(currGitterBox)[0].Qta;
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// indica il gitterbox correntemente selezionato
- ///
- protected string currGitterBox
- {
- get
- {
- return memLayer.ML.StringSessionObj("currGitterBox");
- }
- set
- {
- memLayer.ML.setSessionVal("currGitterBox", value);
- }
- }
- ///
- /// controllo booleano sul gitterbox se sia ok x caricamento altri pezzi (ovvero en contiene meno del max consentito
- ///
- protected bool gitterboxOk
- {
- get
- {
- bool answ = false;
- int maxPezzi = memLayer.ML.confReadInt("qtaOdette");
- int numPezzi = maxPezzi;
- try
- {
- numPezzi = (int)MagClass.magazzino.taCartellini.getByUdc(currGitterBox)[0].Qta;
- }
- catch
- {
- httpLog(string.Format("Non sono riuscito a trovare dati per il gitterbox {0}", currGitterBox), tipoLog.ERROR);
- }
- // controllo se il codice sia "Pieno", ovvero max pezzi
- if (numPezzi < maxPezzi)
- {
- answ = true;
- }
- return answ;
- }
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- string postazione_IP = "";
- try
- {
- postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
- }
- catch
- { }
- logger.lg.scriviLog(postazione_IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- string postazione_IP = "";
- try
- {
- postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
- }
- catch
- { }
- logger.lg.scriviLog(postazione_IP + testoLog, tipo);
- return answ;
- }
-
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- lblMessaggi.Text = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Gitterbox:
- // imposto il gitterbox corrente
- currGitterBox = barcodeIn;
- if (gitterboxOk)
- {
- // controllo se il gitterbox non sia stato già associato ad una etichetta odette - non si può spostare
- if (Odette.mgr.gitterboxInOdette(currGitterBox))
- {
- currGitterBox = "";
- lblMessaggi.Text += " - gitterbox associatoad odette!!! non impostabile.";
- pnlAll.CssClass = "stileComandoKo";
- }
- else
- {
- lblMessaggi.Text += " - impostato nuovo gitterbox di destinazione!";
- pnlAll.CssClass = "stileComandoOk";
- }
- }
- else
- {
- lblMessaggi.Text += " - gitterbox pieno!!! impostato, ma non si possono versare altri pezzi.";
- pnlAll.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.DataMatrixTrovato:
- // se c'è un gitterbox attivo sposto il datamatrix
- if (currGitterBox != "")
- {
- if (gitterboxOk)
- {
- decimal dataMatrix = Convert.ToDecimal(barcodeIn);
- // controllo che esissta il datamatrix...
- if (Odette.mgr.datamatrixEsiste(dataMatrix))
- {
- // effettuo spostamento del datamatrix nel nuovo gitterbox
- if (!Odette.mgr.datamatrixInOdette(dataMatrix))
- {
- // controllo che il gitterbox sia coerente col datamatrix per prodotto...
- if (Odette.mgr.dtMtxGtboxCompatibili(dataMatrix, currGitterBox))
- {
- DataMatrix.mgr.taElencoDM.spostaInGitterbox(dataMatrix, currGitterBox, MagClass.magazzino.CodSoggCurrUser);
- lblMessaggi.Text += " - spostato nel gitterbox attivo!";
- pnlAll.CssClass = "stileComandoAdd";
- }
- else
- {
- lblMessaggi.Text += " - datamatrix non spostabile, il gitterbox contiene prodotti diversi!";
- pnlAll.CssClass = "stileErr01";
- }
- }
- else
- {
- lblMessaggi.Text += " - datamatrix non spostabile, in gitterbox già associato ad odette!";
- pnlAll.CssClass = "stileErr03";
- }
- }
- else
- {
- lblMessaggi.Text += " - datamatrix non trovato!";
- pnlAll.CssClass = "stileErr02";
- }
- }
- else
- {
- lblMessaggi.Text += " - il gitterbox è pieno!!!";
- pnlAll.CssClass = "stileComandoKo";
- }
- }
- else
- {
- // altrimenti segnalo che manca il gitterbox di destinazione
- lblMessaggi.Text += " - errore, manca un gitterbox di destinazione!";
- pnlAll.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Comando:
- // controllo se è svuota gitterbox, nel caso lo svuoto
- string cmdSvuotaGbox = memLayer.ML.cdv("cmdSvuotaGitterBox");
- string cmdEsci = memLayer.ML.cdv("cmdEsci");
- if (barcodeIn == cmdSvuotaGbox)
- {
- if (gitterboxOk)
- {
- DataMatrix.mgr.taElencoDM.svuotaGitterbox(currGitterBox, MagClass.magazzino.CodSoggCurrUser);
- lblMessaggi.Text += " - Gitterbox svuotato!";
- pnlAll.CssClass = "stileAttesa";
- }
- }
- else if (barcodeIn == cmdEsci)
- {
- currGitterBox = "";
- Response.Redirect("~/menu.aspx");
- }
- else
- {
- lblMessaggi.Text += " - codice comando non riconosciuto!";
- }
- break;
- default:
- lblMessaggi.Text += " - codice non riconosciuto!";
- pnlAll.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- else
- {
- lblMessaggi.Text = traduci("AttesaBCode");
- pnlAll.CssClass = "stileAttesa";
- }
- grView.DataBind();
- txtBarcode.Focus();
- }
- ///
- ///
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
+ // effettuo spostamento del datamatrix nel nuovo gitterbox
+ if (!Odette.mgr.datamatrixInOdette(dataMatrix))
+ {
+ // controllo che il gitterbox sia coerente col datamatrix per prodotto...
+ if (Odette.mgr.dtMtxGtboxCompatibili(dataMatrix, currGitterBox))
+ {
+ DataMatrix_mgr.taElencoDM.spostaInGitterbox(dataMatrix, currGitterBox, MagClass.magazzino.CodSoggCurrUser);
+ lblMessaggi.Text += " - spostato nel gitterbox attivo!";
+ pnlAll.CssClass = "stileComandoAdd";
+ }
+ else
+ {
+ lblMessaggi.Text += " - datamatrix non spostabile, il gitterbox contiene prodotti diversi!";
+ pnlAll.CssClass = "stileErr01";
+ }
+ }
+ else
+ {
+ lblMessaggi.Text += " - datamatrix non spostabile, in gitterbox già associato ad odette!";
+ pnlAll.CssClass = "stileErr03";
+ }
}
else
{
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- // cerco tra datamatrix
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.Gitterbox;
- }
- else
- {
- trovati = DataMatrix.mgr.taElencoDM.getByCode(Convert.ToDecimal(barcodeIn)).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.DataMatrixTrovato;
- }
- }
-
- }
- catch
- {
- }
+ lblMessaggi.Text += " - datamatrix non trovato!";
+ pnlAll.CssClass = "stileErr02";
}
- return answ;
+ }
+ else
+ {
+ lblMessaggi.Text += " - il gitterbox è pieno!!!";
+ pnlAll.CssClass = "stileComandoKo";
+ }
}
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
+ else
{
- return txtBarcode.Text.Trim();
+ // altrimenti segnalo che manca il gitterbox di destinazione
+ lblMessaggi.Text += " - errore, manca un gitterbox di destinazione!";
+ pnlAll.CssClass = "stileComandoKo";
}
- set
+ break;
+ case tipoCodiceBarcode.Comando:
+ // controllo se è svuota gitterbox, nel caso lo svuoto
+ string cmdSvuotaGbox = memLayer.ML.cdv("cmdSvuotaGitterBox");
+ string cmdEsci = memLayer.ML.cdv("cmdEsci");
+ if (barcodeIn == cmdSvuotaGbox)
{
- txtBarcode.Text = value;
+ if (gitterboxOk)
+ {
+ DataMatrix_mgr.taElencoDM.svuotaGitterbox(currGitterBox, MagClass.magazzino.CodSoggCurrUser);
+ lblMessaggi.Text += " - Gitterbox svuotato!";
+ pnlAll.CssClass = "stileAttesa";
+ }
}
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
+ else if (barcodeIn == cmdEsci)
{
- return memLayer.ML.confReadBool("forceUppercase");
+ currGitterBox = "";
+ Response.Redirect("~/menu.aspx");
}
+ else
+ {
+ lblMessaggi.Text += " - codice comando non riconosciuto!";
+ }
+ break;
+ default:
+ lblMessaggi.Text += " - codice non riconosciuto!";
+ pnlAll.CssClass = "stileComandoND";
+ break;
}
+ barcodeIn = "";
+ }
+ else
+ {
+ lblMessaggi.Text = traduci("AttesaBCode");
+ pnlAll.CssClass = "stileAttesa";
+ }
+ grView.DataBind();
+ txtBarcode.Focus();
}
+ ///
+ ///
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ // cerco tra datamatrix
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.Gitterbox;
+ }
+ else
+ {
+ trovati = DataMatrix_mgr.taElencoDM.getByCode(Convert.ToDecimal(barcodeIn)).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.DataMatrixTrovato;
+ }
+ }
+
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_trascPn2Part.ascx.cs b/GMW/WebUserControls/mod_trascPn2Part.ascx.cs
index 3391aa07..63f47d26 100644
--- a/GMW/WebUserControls/mod_trascPn2Part.ascx.cs
+++ b/GMW/WebUserControls/mod_trascPn2Part.ascx.cs
@@ -6,190 +6,194 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_trascPn2Part : ApplicationUserControl
+ public partial class mod_trascPn2Part : ApplicationUserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
{
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- resetSelezione();
- }
- ///
- /// resetta la selezione dei valori in caso di modifiche su altri controlli
- ///
- public void resetSelezione()
- {
- grView.SelectedIndex = -1;
- grView.DataBind();
- raiseEvent(ucEvType.Reset);
- }
- ///
- /// inserisce nuovo valore da footer
- ///
- ///
- ///
- protected void lblIns_click(object sender, EventArgs e)
- {
- // click su inserimento, chiamo il metodo insert dell'ObjectDataSource
- ods.Insert();
- }
- ///
- /// gestione evento richiesta nuovo valore (mostra footer, ...)
- ///
- ///
- ///
- protected void btnNew_Click(object sender, EventArgs e)
- {
- // reset selezione...
- resetSelezione();
- // mostro il footer oppure la riga dei dettagli x nuovo...
- if (grView.FooterRow != null)
- {
- grView.FooterRow.Visible = true;
- }
- }
- ///
- /// determina se sia eliminabile il record (=non usato)
- ///
- ///
- ///
- public bool delEnabled(object idxObj)
- {
- bool answ = isWritable();
-
- return answ;
- }
-
- ///
- /// elenco colonne del datagrid
- ///
- ///
- protected DataColumnCollection colonneObj()
- {
- DS_DataMatrix.TrascDatamatrixDataTable tabella = new DS_DataMatrix.TrascDatamatrixDataTable();
- DataColumnCollection colonne = tabella.Columns;
- return colonne;
- }
- ///
- /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
- /// questi devono essere opportunamente nominati (es: txt{0}, dl{0}, ...)
- ///
- ///
- ///
- protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
- {
- //recupero la riga footer...
- DataColumnCollection colonne = colonneObj();
- string nomeCol;
- string tipoColonna = "";
- foreach (DataColumn colonna in colonne)
- {
- nomeCol = colonna.ColumnName;
- // cerco un textbox o quello che sia...
- if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
- {
- tipoColonna = "textBox";
- }
- else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
- {
- tipoColonna = "dropDownList";
- }
- else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
- {
- tipoColonna = "checkBox";
- }
- else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
- {
- tipoColonna = "selAjax";
- }
- // in base al tipo salvo negli inputparameters dell'ODS
- switch (tipoColonna)
- {
- case "textBox":
- e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
- break;
- case "dropDownList":
- e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
- break;
- case "checkBox":
- e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
- break;
- case "selAjax":
- e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
- break;
- default:
- break;
- }
- tipoColonna = "";
- }
- if (e.InputParameters["PartNumber"] == null) e.InputParameters["PartNumber"] = "";
- if (e.InputParameters["Particolare"] == null) e.InputParameters["Particolare"] = "";
- if (e.InputParameters["FormatoDtmx"] == null) e.InputParameters["FormatoDtmx"] = "";
- }
-
- protected void ods_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
- {
- if (e.InputParameters["Original_PartNumber"] == null) e.InputParameters["Original_PartNumber"] = "";
- }
-
- protected void grView_SelectedIndexChanged(object sender, EventArgs e)
- {
- raiseEvent(ucEvType.Selected);
- }
- public string FormatoDtmx
- {
- get
- {
- return hfFormatoDtmx.Value;
- }
- set
- {
- hfFormatoDtmx.Value = value;
- grView.SelectedIndex = -1;
- }
- }
- public string PartNumber
- {
- get
- {
- return hfPartNumber.Value;
- }
- set
- {
- hfPartNumber.Value = value;
- grView.SelectedIndex = -1;
- }
- }
- public string PartNumberSel
- {
- get
- {
- string answ = "";
- try
- {
- answ = grView.SelectedDataKey["PartNumber"].ToString();
- }
- catch
- { }
- return answ;
- }
- }
- protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
- {
- if (e.InputParameters["PartNumber"] == null) e.InputParameters["PartNumber"] = "";
- if (e.InputParameters["Particolare"] == null) e.InputParameters["Particolare"] = "";
- if (e.InputParameters["FormatoDtmx"] == null) e.InputParameters["FormatoDtmx"] = "";
- if (e.InputParameters["Original_PartNumber"] == null) e.InputParameters["Original_PartNumber"] = "";
- }
-
- protected void btnNewFromEmpty_Click(object sender, EventArgs e)
- {
- // creo record lunghezza 1...
- DataMatrix.mgr.taTDtmx.Insert("000", "000", FormatoDtmx);
- grView.DataBind();
- }
+ resetSelezione();
}
+ ///
+ /// resetta la selezione dei valori in caso di modifiche su altri controlli
+ ///
+ public void resetSelezione()
+ {
+ grView.SelectedIndex = -1;
+ grView.DataBind();
+ raiseEvent(ucEvType.Reset);
+ }
+ ///
+ /// inserisce nuovo valore da footer
+ ///
+ ///
+ ///
+ protected void lblIns_click(object sender, EventArgs e)
+ {
+ // click su inserimento, chiamo il metodo insert dell'ObjectDataSource
+ ods.Insert();
+ }
+ ///
+ /// gestione evento richiesta nuovo valore (mostra footer, ...)
+ ///
+ ///
+ ///
+ protected void btnNew_Click(object sender, EventArgs e)
+ {
+ // reset selezione...
+ resetSelezione();
+ // mostro il footer oppure la riga dei dettagli x nuovo...
+ if (grView.FooterRow != null)
+ {
+ grView.FooterRow.Visible = true;
+ }
+ }
+ ///
+ /// determina se sia eliminabile il record (=non usato)
+ ///
+ ///
+ ///
+ public bool delEnabled(object idxObj)
+ {
+ bool answ = isWritable();
+
+ return answ;
+ }
+
+ ///
+ /// elenco colonne del datagrid
+ ///
+ ///
+ protected DataColumnCollection colonneObj()
+ {
+ DS_DataMatrix.TrascDatamatrixDataTable tabella = new DS_DataMatrix.TrascDatamatrixDataTable();
+ DataColumnCollection colonne = tabella.Columns;
+ return colonne;
+ }
+ ///
+ /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
+ /// questi devono essere opportunamente nominati (es: txt{0}, dl{0}, ...)
+ ///
+ ///
+ ///
+ protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ //recupero la riga footer...
+ DataColumnCollection colonne = colonneObj();
+ string nomeCol;
+ string tipoColonna = "";
+ foreach (DataColumn colonna in colonne)
+ {
+ nomeCol = colonna.ColumnName;
+ // cerco un textbox o quello che sia...
+ if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
+ {
+ tipoColonna = "textBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
+ {
+ tipoColonna = "dropDownList";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
+ {
+ tipoColonna = "checkBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
+ {
+ tipoColonna = "selAjax";
+ }
+ // in base al tipo salvo negli inputparameters dell'ODS
+ switch (tipoColonna)
+ {
+ case "textBox":
+ e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
+ break;
+ case "dropDownList":
+ e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
+ break;
+ case "checkBox":
+ e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
+ break;
+ case "selAjax":
+ e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
+ break;
+ default:
+ break;
+ }
+ tipoColonna = "";
+ }
+ if (e.InputParameters["PartNumber"] == null) e.InputParameters["PartNumber"] = "";
+ if (e.InputParameters["Particolare"] == null) e.InputParameters["Particolare"] = "";
+ if (e.InputParameters["FormatoDtmx"] == null) e.InputParameters["FormatoDtmx"] = "";
+ }
+
+ protected void ods_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ if (e.InputParameters["Original_PartNumber"] == null) e.InputParameters["Original_PartNumber"] = "";
+ }
+
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ raiseEvent(ucEvType.Selected);
+ }
+ public string FormatoDtmx
+ {
+ get
+ {
+ return hfFormatoDtmx.Value;
+ }
+ set
+ {
+ hfFormatoDtmx.Value = value;
+ grView.SelectedIndex = -1;
+ }
+ }
+ public string PartNumber
+ {
+ get
+ {
+ return hfPartNumber.Value;
+ }
+ set
+ {
+ hfPartNumber.Value = value;
+ grView.SelectedIndex = -1;
+ }
+ }
+ public string PartNumberSel
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = grView.SelectedDataKey["PartNumber"].ToString();
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ if (e.InputParameters["PartNumber"] == null) e.InputParameters["PartNumber"] = "";
+ if (e.InputParameters["Particolare"] == null) e.InputParameters["Particolare"] = "";
+ if (e.InputParameters["FormatoDtmx"] == null) e.InputParameters["FormatoDtmx"] = "";
+ if (e.InputParameters["Original_PartNumber"] == null) e.InputParameters["Original_PartNumber"] = "";
+ }
+
+ protected void btnNewFromEmpty_Click(object sender, EventArgs e)
+ {
+ // creo record lunghezza 1...
+ DataMatrix_mgr.taTDtmx.Insert("000", "000", FormatoDtmx);
+ grView.DataBind();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_verificaDmtx.ascx.cs b/GMW/WebUserControls/mod_verificaDmtx.ascx.cs
index fb5d2a5b..8f7a329c 100644
--- a/GMW/WebUserControls/mod_verificaDmtx.ascx.cs
+++ b/GMW/WebUserControls/mod_verificaDmtx.ascx.cs
@@ -3,150 +3,154 @@ using System;
namespace GMW.WebUserControls
{
- public partial class mod_verificaDmtx : GMW_data.UserControl
+ public partial class mod_verificaDmtx : GMW_data.UserControl
+ {
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ protected void Page_Load(object sender, EventArgs e)
{
- protected void Page_Load(object sender, EventArgs e)
- {
- txtBarcode.Focus();
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- bool isDecodOk = false;
- bool isInList = true;
-
- // verifico
- isDecodOk = (DataMatrix.mgr.taAnagFormDtx.getFormatiCompatibili(barcodeIn).Rows.Count > 0);
- isInList = (DataMatrix.mgr.taVED.getByKey(barcodeIn).Rows.Count > 0);
-
- // imposto di conseguenza grafica e info
- string classDivDec = "col-sm-6 bg-danger";
- string classDivList = "col-sm-6 bg-danger";
- if (isDecodOk)
- {
- //divDecod.Attributes.Add("class", "col-sm-6 bg-success");
- classDivDec = "col-sm-6 bg-success";
- }
- else
- {
- //divDecod.Attributes.Add("class", "col-sm-6 bg-danger");
- classDivDec = "col-sm-6 bg-danger";
- }
- if (isInList)
- {
- //divElenco.Attributes.Add("class", "col-sm-6 bg-success");
- classDivList = "col-sm-6 bg-success";
- }
- else
- {
- //divElenco.Attributes.Add("class", "col-sm-6 bg-danger");
- classDivList = "col-sm-6 bg-danger";
- }
- // aggiorno visualizzazione...
- if (isDecodOk || isInList)
- {
- lblBarcode.Text = string.Format("Datamatrix: {0}", barcodeIn);
- if (isDecodOk)
- {
- lblEsitoDec.Text = string.Format("{0}: OK", traduci("VerificaDecodifica"));
- DS_DataMatrix.AnagFormatiDtmxRow riga = (DS_DataMatrix.AnagFormatiDtmxRow)DataMatrix.mgr.taAnagFormDtx.getFormatiCompatibili(barcodeIn).Rows[0];
- lblFormatoDmtxDec.Text = string.Format("Formato: {0}", riga.FormatoDtmx);
- // controllo se il PartNum venga decodificato --> lo decodifico e mostro entrambi
- string PartNumIn = barcodeIn.Substring(riga.PartNumberPos - 1, riga.PartNumberLun);
- string PartNum = "";
- string Particolare = "";
- if (DataMatrix.mgr.taTPN.getByPN_IN(PartNumIn).Rows.Count > 0)
- {
- PartNum = ((DS_DataMatrix.TrascPartNumRow)DataMatrix.mgr.taTPN.getByPN_IN(PartNumIn).Rows[0]).PartNumberOUT;
- }
- else
- {
- PartNum = PartNumIn;
- }
- try
- {
- Particolare = ((DS_DataMatrix.TrascDatamatrixRow)DataMatrix.mgr.taTDtmx.getByPnFormato(riga.FormatoDtmx, PartNum).Rows[0]).Particolare;
- }
- catch
- {
- Particolare = "Non Trovato";
- lblEsitoDec.Text += "/ND";
- classDivDec = "col-sm-6 bg-warning";
- }
- lblPartNumDec.Text = string.Format("Part Num: {0}", PartNum);
- // se fosse stato decodificato
- if (PartNum != PartNumIn)
- {
- lblPartNumDec.Text += string.Format("
({0})", PartNumIn);
- }
- lblCodPartDec.Text = string.Format("Cod Part: {0}", Particolare);
- }
- else
- {
- lblEsitoDec.Text += string.Format("{0}: KO", traduci("VerificaDecodifica"));
- lblFormatoDmtxDec.Text = "...";
- lblPartNumDec.Text = "..";
- lblCodPartDec.Text = ".";
- }
- if (isInList)
- {
- lblEsitoAcq.Text = string.Format("{0}: OK", traduci("VerificaAcquisizioni"));
- DS_DataMatrix.v_ElencoDmtxRow riga = ((DS_DataMatrix.v_ElencoDmtxRow)DataMatrix.mgr.taVED.getByKey(barcodeIn).Rows[0]);
- lblFormatoDmtxAcq.Text = string.Format("Formato MM: {0}", riga.FormatoDtmxMM);
- lblEsitoMarc.Text = string.Format("Esito marcatura MM: {0}", riga.EsitoMarcatura);
- lblPartNumAcq.Text = string.Format("Part Num MM: {0}", riga.PartNumber);
- }
- else
- {
- lblEsitoAcq.Text = string.Format("{0}: KO", traduci("VerificaAcquisizioni"));
- lblFormatoDmtxAcq.Text = "...";
- lblEsitoMarc.Text = "..";
- lblPartNumAcq.Text = ".";
- }
- }
- else
- {
- lblBarcode.Text = string.Format("Codice non riconosciuto: {0}", barcodeIn);
- lblEsitoDec.Text = "....";
- lblFormatoDmtxDec.Text = "...";
- lblPartNumDec.Text = "..";
- lblCodPartDec.Text = ".";
- lblEsitoAcq.Text = "....";
- lblFormatoDmtxAcq.Text = "...";
- lblEsitoMarc.Text = "..";
- lblPartNumAcq.Text = ".";
- }
-
- // fix grafico
- divDecod.Attributes.Remove("class");
- divDecod.Attributes.Add("class", classDivDec);
- divElenco.Attributes.Remove("class");
- divElenco.Attributes.Add("class", classDivList);
-
- // sistemazione generale
- barcodeIn = "";
- txtBarcode.Focus();
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
-
- protected void txtBarcode_TextChanged(object sender, EventArgs e)
- {
- checkBarcode();
- }
+ txtBarcode.Focus();
}
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ bool isDecodOk = false;
+ bool isInList = true;
+
+ // verifico
+ isDecodOk = (DataMatrix_mgr.taAnagFormDtx.getFormatiCompatibili(barcodeIn).Rows.Count > 0);
+ isInList = (DataMatrix_mgr.taVED.getByKey(barcodeIn).Rows.Count > 0);
+
+ // imposto di conseguenza grafica e info
+ string classDivDec = "col-sm-6 bg-danger";
+ string classDivList = "col-sm-6 bg-danger";
+ if (isDecodOk)
+ {
+ //divDecod.Attributes.Add("class", "col-sm-6 bg-success");
+ classDivDec = "col-sm-6 bg-success";
+ }
+ else
+ {
+ //divDecod.Attributes.Add("class", "col-sm-6 bg-danger");
+ classDivDec = "col-sm-6 bg-danger";
+ }
+ if (isInList)
+ {
+ //divElenco.Attributes.Add("class", "col-sm-6 bg-success");
+ classDivList = "col-sm-6 bg-success";
+ }
+ else
+ {
+ //divElenco.Attributes.Add("class", "col-sm-6 bg-danger");
+ classDivList = "col-sm-6 bg-danger";
+ }
+ // aggiorno visualizzazione...
+ if (isDecodOk || isInList)
+ {
+ lblBarcode.Text = string.Format("Datamatrix: {0}", barcodeIn);
+ if (isDecodOk)
+ {
+ lblEsitoDec.Text = string.Format("{0}: OK", traduci("VerificaDecodifica"));
+ DS_DataMatrix.AnagFormatiDtmxRow riga = (DS_DataMatrix.AnagFormatiDtmxRow)DataMatrix_mgr.taAnagFormDtx.getFormatiCompatibili(barcodeIn).Rows[0];
+ lblFormatoDmtxDec.Text = string.Format("Formato: {0}", riga.FormatoDtmx);
+ // controllo se il PartNum venga decodificato --> lo decodifico e mostro entrambi
+ string PartNumIn = barcodeIn.Substring(riga.PartNumberPos - 1, riga.PartNumberLun);
+ string PartNum = "";
+ string Particolare = "";
+ if (DataMatrix_mgr.taTPN.getByPN_IN(PartNumIn).Rows.Count > 0)
+ {
+ PartNum = ((DS_DataMatrix.TrascPartNumRow)DataMatrix_mgr.taTPN.getByPN_IN(PartNumIn).Rows[0]).PartNumberOUT;
+ }
+ else
+ {
+ PartNum = PartNumIn;
+ }
+ try
+ {
+ Particolare = ((DS_DataMatrix.TrascDatamatrixRow)DataMatrix_mgr.taTDtmx.getByPnFormato(riga.FormatoDtmx, PartNum).Rows[0]).Particolare;
+ }
+ catch
+ {
+ Particolare = "Non Trovato";
+ lblEsitoDec.Text += "/ND";
+ classDivDec = "col-sm-6 bg-warning";
+ }
+ lblPartNumDec.Text = string.Format("Part Num: {0}", PartNum);
+ // se fosse stato decodificato
+ if (PartNum != PartNumIn)
+ {
+ lblPartNumDec.Text += string.Format("
({0})", PartNumIn);
+ }
+ lblCodPartDec.Text = string.Format("Cod Part: {0}", Particolare);
+ }
+ else
+ {
+ lblEsitoDec.Text += string.Format("{0}: KO", traduci("VerificaDecodifica"));
+ lblFormatoDmtxDec.Text = "...";
+ lblPartNumDec.Text = "..";
+ lblCodPartDec.Text = ".";
+ }
+ if (isInList)
+ {
+ lblEsitoAcq.Text = string.Format("{0}: OK", traduci("VerificaAcquisizioni"));
+ DS_DataMatrix.v_ElencoDmtxRow riga = ((DS_DataMatrix.v_ElencoDmtxRow)DataMatrix_mgr.taVED.getByKey(barcodeIn).Rows[0]);
+ lblFormatoDmtxAcq.Text = string.Format("Formato MM: {0}", riga.FormatoDtmxMM);
+ lblEsitoMarc.Text = string.Format("Esito marcatura MM: {0}", riga.EsitoMarcatura);
+ lblPartNumAcq.Text = string.Format("Part Num MM: {0}", riga.PartNumber);
+ }
+ else
+ {
+ lblEsitoAcq.Text = string.Format("{0}: KO", traduci("VerificaAcquisizioni"));
+ lblFormatoDmtxAcq.Text = "...";
+ lblEsitoMarc.Text = "..";
+ lblPartNumAcq.Text = ".";
+ }
+ }
+ else
+ {
+ lblBarcode.Text = string.Format("Codice non riconosciuto: {0}", barcodeIn);
+ lblEsitoDec.Text = "....";
+ lblFormatoDmtxDec.Text = "...";
+ lblPartNumDec.Text = "..";
+ lblCodPartDec.Text = ".";
+ lblEsitoAcq.Text = "....";
+ lblFormatoDmtxAcq.Text = "...";
+ lblEsitoMarc.Text = "..";
+ lblPartNumAcq.Text = ".";
+ }
+
+ // fix grafico
+ divDecod.Attributes.Remove("class");
+ divDecod.Attributes.Add("class", classDivDec);
+ divElenco.Attributes.Remove("class");
+ divElenco.Attributes.Add("class", classDivList);
+
+ // sistemazione generale
+ barcodeIn = "";
+ txtBarcode.Focus();
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+
+ protected void txtBarcode_TextChanged(object sender, EventArgs e)
+ {
+ checkBarcode();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW_data/DataMatrix.cs b/GMW_data/DataMatrix.cs
index 64761241..58f2417e 100644
--- a/GMW_data/DataMatrix.cs
+++ b/GMW_data/DataMatrix.cs
@@ -2,161 +2,161 @@
namespace GMW_data
{
+ ///
+ /// fa da proxy singleton x gli oggetti legati ai DATAMATRIX
+ ///
+ public class DataMatrix
+ {
+ #region area table adapters
+
+ public DS_DataMatrixTableAdapters.ElencoDataMatrixTableAdapter taElencoDM;
+ public DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter taDtMtxOrig;
+ public DS_DataMatrixTableAdapters.stp_verificaDtxTableAdapter taVerifica;
+ public DS_DataMatrixTableAdapters.stp_decodeDtxTableAdapter taDecode;
+ public DS_DataMatrixTableAdapters.stp_conteggioDtxTableAdapter taConteggio;
+ public DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter taDtxAcq;
+ public DS_DataMatrixTableAdapters.Dtx2UDCTableAdapter taDtx2UDC;
+ public DS_DataMatrixTableAdapters.stp_getFirstLastDtxTableAdapter taFirstLastUdc;
+ public DS_DataMatrixTableAdapters.stp_DtxGetAvailFreeAnomTableAdapter taDtxAvailFree;
+ public DS_DataMatrixTableAdapters.stp_DtxCheckBlockedTableAdapter taDtxBlocked;
+ public DS_DataMatrixTableAdapters.Attr2DtxTableAdapter taAtt2Dtx;
+ public DS_DataMatrixTableAdapters.AnagFormatiDtmxTableAdapter taAnagFormDtx;
+ public DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter taDtxAcquisiti;
+ public DS_DataMatrixTableAdapters.v_ElencoDmtxTableAdapter taVED;
+ public DS_DataMatrixTableAdapters.TabSpecDtxTableAdapter taSpecDtmx;
+ public DS_DataMatrixTableAdapters.TrascPartNumTableAdapter taTPN;
+ public DS_DataMatrixTableAdapters.TrascDatamatrixTableAdapter taTDtmx;
+ public DS_DataMatrixTableAdapters.Linea2Dtx_IETableAdapter taL2D;
+
///
- /// fa da proxy singleton x gli oggetti legati ai DATAMATRIX
+ /// init dei table adapters
///
- public class DataMatrix
+ protected void initTA()
{
- #region area table adapters
-
- public DS_DataMatrixTableAdapters.ElencoDataMatrixTableAdapter taElencoDM;
- public DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter taDtMtxOrig;
- public DS_DataMatrixTableAdapters.stp_verificaDtxTableAdapter taVerifica;
- public DS_DataMatrixTableAdapters.stp_decodeDtxTableAdapter taDecode;
- public DS_DataMatrixTableAdapters.stp_conteggioDtxTableAdapter taConteggio;
- public DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter taDtxAcq;
- public DS_DataMatrixTableAdapters.Dtx2UDCTableAdapter taDtx2UDC;
- public DS_DataMatrixTableAdapters.stp_getFirstLastDtxTableAdapter taFirstLastUdc;
- public DS_DataMatrixTableAdapters.stp_DtxGetAvailFreeAnomTableAdapter taDtxAvailFree;
- public DS_DataMatrixTableAdapters.stp_DtxCheckBlockedTableAdapter taDtxBlocked;
- public DS_DataMatrixTableAdapters.Attr2DtxTableAdapter taAtt2Dtx;
- public DS_DataMatrixTableAdapters.AnagFormatiDtmxTableAdapter taAnagFormDtx;
- public DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter taDtxAcquisiti;
- public DS_DataMatrixTableAdapters.v_ElencoDmtxTableAdapter taVED;
- public DS_DataMatrixTableAdapters.TabSpecDtxTableAdapter taSpecDtmx;
- public DS_DataMatrixTableAdapters.TrascPartNumTableAdapter taTPN;
- public DS_DataMatrixTableAdapters.TrascDatamatrixTableAdapter taTDtmx;
- public DS_DataMatrixTableAdapters.Linea2Dtx_IETableAdapter taL2D;
-
- ///
- /// init dei table adapters
- ///
- protected void initTA()
- {
- taElencoDM = new GMW_data.DS_DataMatrixTableAdapters.ElencoDataMatrixTableAdapter();
- taDtMtxOrig = new GMW_data.DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter();
- taDtMtxOrig = new GMW_data.DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter();
- taVerifica = new DS_DataMatrixTableAdapters.stp_verificaDtxTableAdapter();
- taDecode = new DS_DataMatrixTableAdapters.stp_decodeDtxTableAdapter();
- taConteggio = new DS_DataMatrixTableAdapters.stp_conteggioDtxTableAdapter();
- taDtxAcq = new DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter();
- taDtx2UDC = new DS_DataMatrixTableAdapters.Dtx2UDCTableAdapter();
- taFirstLastUdc = new DS_DataMatrixTableAdapters.stp_getFirstLastDtxTableAdapter();
- taDtxAvailFree = new DS_DataMatrixTableAdapters.stp_DtxGetAvailFreeAnomTableAdapter();
- taDtxBlocked = new DS_DataMatrixTableAdapters.stp_DtxCheckBlockedTableAdapter();
- taAtt2Dtx = new DS_DataMatrixTableAdapters.Attr2DtxTableAdapter();
- taAnagFormDtx = new DS_DataMatrixTableAdapters.AnagFormatiDtmxTableAdapter();
- taDtxAcquisiti = new DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter();
- taVED = new DS_DataMatrixTableAdapters.v_ElencoDmtxTableAdapter();
- taSpecDtmx = new DS_DataMatrixTableAdapters.TabSpecDtxTableAdapter();
- taTPN = new DS_DataMatrixTableAdapters.TrascPartNumTableAdapter();
- taTDtmx = new DS_DataMatrixTableAdapters.TrascDatamatrixTableAdapter();
- taL2D = new DS_DataMatrixTableAdapters.Linea2Dtx_IETableAdapter();
- }
- ///
- /// effettua setup dei connection strings da web.config delal singola applicazione
- ///
- protected virtual void setupConnectionStringBase()
- {
- // connections strings del db verso GMW
- string connString = memLayer.ML.confReadString("GMWConnectionString");
- taElencoDM.Connection.ConnectionString = connString;
- taDtMtxOrig.Connection.ConnectionString = connString;
- taVerifica.Connection.ConnectionString = connString;
- taDecode.Connection.ConnectionString = connString;
- taConteggio.Connection.ConnectionString = connString;
- taDtxAcq.Connection.ConnectionString = connString;
- taDtx2UDC.Connection.ConnectionString = connString;
- taFirstLastUdc.Connection.ConnectionString = connString;
- taDtxAvailFree.Connection.ConnectionString = connString;
- taDtxBlocked.Connection.ConnectionString = connString;
- taAtt2Dtx.Connection.ConnectionString = connString;
- taAnagFormDtx.Connection.ConnectionString = connString;
- taDtxAcquisiti.Connection.ConnectionString = connString;
- taVED.Connection.ConnectionString = connString;
- taSpecDtmx.Connection.ConnectionString = connString;
- taTPN.Connection.ConnectionString = connString;
- taTDtmx.Connection.ConnectionString = connString;
- taL2D.Connection.ConnectionString = connString;
- }
-
- #endregion
-
- public DataMatrix()
- {
- initTA();
- setupConnectionStringBase();
- }
-
- ///
- /// singleton datamatrix
- ///
- public static DataMatrix mgr = new DataMatrix();
- ///
- /// effettua import nuovi dati datamatrix/gitterbox
- ///
- ///
- public bool importNuoviDati()
- {
- bool answ = false;
- try
- {
- taElencoDM.stp_DtMtrx_import(memLayer.ML.cdv("CodCS"), memLayer.ML.cdvi("IdxPosizioneOdette"), MagClass.magazzino.CodSoggCurrUser);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce codice gitterbox dato datamatrix
- ///
- ///
- ///
- public string gitterboxFromDataMatrix(decimal codDataMatrix)
- {
- string answ = "";
- try
- {
- answ = taElencoDM.getByCode(codDataMatrix)[0].CodGitterbox;
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce codice gitterbox ORIGINALE (pre import) dato datamatrix
- ///
- ///
- ///
- public string gitterboxOrigFromDataMatrix(decimal codDataMatrix)
- {
- string answ = "";
- try
- {
- answ = DataMatrix.mgr.taDtMtxOrig.getByDtMtx(codDataMatrix.ToString())[0].CodGitterbox;
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica SE il codice datamatrix POSSA rappresentare un codice valido, ovvero
- /// - lunghezza compatibile coi formati supportati
- /// - decodifica datamatrix (da formato plausibile, 1 o +) con esito positivo
- ///
- ///
- ///
- public bool maybeDatamatrix(string DataMatrix)
- {
- bool answ = false;
- // provo a verificare direttamente con score function...
- DS_DataMatrix.AnagFormatiDtmxDataTable tab = taAnagFormDtx.getFormatiCompatibili(DataMatrix);
- if (tab.Rows.Count > 0)
- {
- answ = true;
- }
- return answ;
- }
+ taElencoDM = new GMW_data.DS_DataMatrixTableAdapters.ElencoDataMatrixTableAdapter();
+ taDtMtxOrig = new GMW_data.DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter();
+ taDtMtxOrig = new GMW_data.DS_DataMatrixTableAdapters.v_trasfDataMatrixTableAdapter();
+ taVerifica = new DS_DataMatrixTableAdapters.stp_verificaDtxTableAdapter();
+ taDecode = new DS_DataMatrixTableAdapters.stp_decodeDtxTableAdapter();
+ taConteggio = new DS_DataMatrixTableAdapters.stp_conteggioDtxTableAdapter();
+ taDtxAcq = new DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter();
+ taDtx2UDC = new DS_DataMatrixTableAdapters.Dtx2UDCTableAdapter();
+ taFirstLastUdc = new DS_DataMatrixTableAdapters.stp_getFirstLastDtxTableAdapter();
+ taDtxAvailFree = new DS_DataMatrixTableAdapters.stp_DtxGetAvailFreeAnomTableAdapter();
+ taDtxBlocked = new DS_DataMatrixTableAdapters.stp_DtxCheckBlockedTableAdapter();
+ taAtt2Dtx = new DS_DataMatrixTableAdapters.Attr2DtxTableAdapter();
+ taAnagFormDtx = new DS_DataMatrixTableAdapters.AnagFormatiDtmxTableAdapter();
+ taDtxAcquisiti = new DS_DataMatrixTableAdapters.v_DtxAcquisitiTableAdapter();
+ taVED = new DS_DataMatrixTableAdapters.v_ElencoDmtxTableAdapter();
+ taSpecDtmx = new DS_DataMatrixTableAdapters.TabSpecDtxTableAdapter();
+ taTPN = new DS_DataMatrixTableAdapters.TrascPartNumTableAdapter();
+ taTDtmx = new DS_DataMatrixTableAdapters.TrascDatamatrixTableAdapter();
+ taL2D = new DS_DataMatrixTableAdapters.Linea2Dtx_IETableAdapter();
}
+ ///
+ /// effettua setup dei connection strings da web.config delal singola applicazione
+ ///
+ protected virtual void setupConnectionStringBase()
+ {
+ // connections strings del db verso GMW
+ string connString = memLayer.ML.confReadString("GMWConnectionString");
+ taElencoDM.Connection.ConnectionString = connString;
+ taDtMtxOrig.Connection.ConnectionString = connString;
+ taVerifica.Connection.ConnectionString = connString;
+ taDecode.Connection.ConnectionString = connString;
+ taConteggio.Connection.ConnectionString = connString;
+ taDtxAcq.Connection.ConnectionString = connString;
+ taDtx2UDC.Connection.ConnectionString = connString;
+ taFirstLastUdc.Connection.ConnectionString = connString;
+ taDtxAvailFree.Connection.ConnectionString = connString;
+ taDtxBlocked.Connection.ConnectionString = connString;
+ taAtt2Dtx.Connection.ConnectionString = connString;
+ taAnagFormDtx.Connection.ConnectionString = connString;
+ taDtxAcquisiti.Connection.ConnectionString = connString;
+ taVED.Connection.ConnectionString = connString;
+ taSpecDtmx.Connection.ConnectionString = connString;
+ taTPN.Connection.ConnectionString = connString;
+ taTDtmx.Connection.ConnectionString = connString;
+ taL2D.Connection.ConnectionString = connString;
+ }
+
+ #endregion
+
+ public DataMatrix()
+ {
+ initTA();
+ setupConnectionStringBase();
+ }
+
+ ///
+ /// singleton datamatrix
+ ///
+ public static DataMatrix mgr = new DataMatrix();
+ ///
+ /// effettua import nuovi dati datamatrix/gitterbox
+ ///
+ ///
+ public bool importNuoviDati()
+ {
+ bool answ = false;
+ try
+ {
+ taElencoDM.stp_DtMtrx_import(memLayer.ML.cdv("CodCS"), memLayer.ML.cdvi("IdxPosizioneOdette"), MagClass.magazzino.CodSoggCurrUser);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce codice gitterbox dato datamatrix
+ ///
+ ///
+ ///
+ public string gitterboxFromDataMatrix(decimal codDataMatrix)
+ {
+ string answ = "";
+ try
+ {
+ answ = taElencoDM.getByCode(codDataMatrix)[0].CodGitterbox;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce codice gitterbox ORIGINALE (pre import) dato datamatrix
+ ///
+ ///
+ ///
+ public string gitterboxOrigFromDataMatrix(decimal codDataMatrix)
+ {
+ string answ = "";
+ try
+ {
+ answ = taDtMtxOrig.getByDtMtx(codDataMatrix.ToString())[0].CodGitterbox;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica SE il codice datamatrix POSSA rappresentare un codice valido, ovvero
+ /// - lunghezza compatibile coi formati supportati
+ /// - decodifica datamatrix (da formato plausibile, 1 o +) con esito positivo
+ ///
+ ///
+ ///
+ public bool maybeDatamatrix(string DataMatrix)
+ {
+ bool answ = false;
+ // provo a verificare direttamente con score function...
+ DS_DataMatrix.AnagFormatiDtmxDataTable tab = taAnagFormDtx.getFormatiCompatibili(DataMatrix);
+ if (tab.Rows.Count > 0)
+ {
+ answ = true;
+ }
+ return answ;
+ }
+ }
}
diff --git a/GMW_data/MagClass.cs b/GMW_data/MagClass.cs
index 855f5fc3..25436e6d 100644
--- a/GMW_data/MagClass.cs
+++ b/GMW_data/MagClass.cs
@@ -5,3386 +5,3386 @@ using System.Reflection;
namespace GMW_data
{
+ ///
+ /// classe gestione operazioni sul magazzino
+ ///
+ public class MagClass
+ {
+ #region area table adapters
+
+ // variabile di tipo table adapter
+ public DS_magazzinoTableAdapters.AnagMagTableAdapter taAnagMag;
+ public DS_magazzinoTableAdapters.BlocchiTableAdapter taBlocchi;
+ public DS_magazzinoTableAdapters.CelleTableAdapter taCelle;
+ public DS_magazzinoTableAdapters.TipoCellaTableAdapter taTipoCella;
+ public DS_magazzinoTableAdapters.ElencoCartelliniTableAdapter taCartellini;
+ public DS_magazzinoTableAdapters.PosizioneUdcCorrenteTableAdapter taPosUdcCorr;
+ public DS_magazzinoTableAdapters.PosizioneUdcStoricoTableAdapter taPosUdcStorico;
+ public DS_magazzinoTableAdapters.V_MagazziniOverviewTableAdapter taMagOverw;
+ public DS_magazzinoTableAdapters.V_DettMagPartTableAdapter taDettMagPart;
+ public DS_magazzinoTableAdapters.v_UdcDetailTableAdapter taDettUDC;
+ public DS_magazzinoTableAdapters.ElencoListePrelievoTableAdapter taElencoListePrelievo;
+ public DS_magazzinoTableAdapters.RigheListePrelievoTableAdapter taRigheListePrelievo;
+ public DS_magazzinoTableAdapters.TipoListaPrelievoTableAdapter taTipoListaPrelievo;
+ public DS_magazzinoTableAdapters.V_ParticolariOverviewTableAdapter taVParticolariOverwiew;
+ public DS_magazzinoTableAdapters.v_particolariEsponenteFiguraTableAdapter taPartExpFig;
+ public DS_magazzinoTableAdapters.V_statoCelleCapienzaAssegnatiTableAdapter taStatoCelle;
+ public DS_magazzinoTableAdapters.RapQualTableAdapter taRapQual;
+ public DS_magazzinoTableAdapters.v_RapQualSuntoTableAdapter taRQ_sunto;
+ public DS_magazzinoTableAdapters.AnagLegheTableAdapter taAnagLeghe;
+ public DS_magazzinoTableAdapters.v_posizioniDelibereTableAdapter taPosizDelib;
+ public DS_magazzinoTableAdapters.AnagParticolariTableAdapter taAnagPart;
+ public DS_magazzinoTableAdapters.AnagPosizioniTableAdapter taAnagPos;
+ public DS_magazzinoTableAdapters.StoricoAzioniOperatoreTableAdapter taSAO;
+ public DS_magazzinoTableAdapters.AnagLineeTableAdapter taAL;
+ public DS_magazzinoTableAdapters.stp_ParticolareInOutOkTableAdapter taPartIO;
+ public DS_magazzinoTableAdapters.Attr2UDCTableAdapter taAtt2UDC;
+ public DS_magazzinoTableAdapters.ElencoAssiemiTableAdapter taEA;
+ public DS_magazzinoTableAdapters.AL2UDCTableAdapter taAL2UDC;
+ public DS_magazzinoTableAdapters.ElencoTrattamentiTableAdapter taET;
+ public DS_magazzinoTableAdapters.v_A2U2DTableAdapter taA2U2D;
+ public DS_magazzinoTableAdapters.UDC_check4deleteTableAdapter taUdcChk4Del;
+
+
///
- /// classe gestione operazioni sul magazzino
+ /// init dei table adapters
///
- public class MagClass
+ protected void initTA()
{
- #region area table adapters
+ // istanzio oggetto
- // variabile di tipo table adapter
- public DS_magazzinoTableAdapters.AnagMagTableAdapter taAnagMag;
- public DS_magazzinoTableAdapters.BlocchiTableAdapter taBlocchi;
- public DS_magazzinoTableAdapters.CelleTableAdapter taCelle;
- public DS_magazzinoTableAdapters.TipoCellaTableAdapter taTipoCella;
- public DS_magazzinoTableAdapters.ElencoCartelliniTableAdapter taCartellini;
- public DS_magazzinoTableAdapters.PosizioneUdcCorrenteTableAdapter taPosUdcCorr;
- public DS_magazzinoTableAdapters.PosizioneUdcStoricoTableAdapter taPosUdcStorico;
- public DS_magazzinoTableAdapters.V_MagazziniOverviewTableAdapter taMagOverw;
- public DS_magazzinoTableAdapters.V_DettMagPartTableAdapter taDettMagPart;
- public DS_magazzinoTableAdapters.v_UdcDetailTableAdapter taDettUDC;
- public DS_magazzinoTableAdapters.ElencoListePrelievoTableAdapter taElencoListePrelievo;
- public DS_magazzinoTableAdapters.RigheListePrelievoTableAdapter taRigheListePrelievo;
- public DS_magazzinoTableAdapters.TipoListaPrelievoTableAdapter taTipoListaPrelievo;
- public DS_magazzinoTableAdapters.V_ParticolariOverviewTableAdapter taVParticolariOverwiew;
- public DS_magazzinoTableAdapters.v_particolariEsponenteFiguraTableAdapter taPartExpFig;
- public DS_magazzinoTableAdapters.V_statoCelleCapienzaAssegnatiTableAdapter taStatoCelle;
- public DS_magazzinoTableAdapters.RapQualTableAdapter taRapQual;
- public DS_magazzinoTableAdapters.v_RapQualSuntoTableAdapter taRQ_sunto;
- public DS_magazzinoTableAdapters.AnagLegheTableAdapter taAnagLeghe;
- public DS_magazzinoTableAdapters.v_posizioniDelibereTableAdapter taPosizDelib;
- public DS_magazzinoTableAdapters.AnagParticolariTableAdapter taAnagPart;
- public DS_magazzinoTableAdapters.AnagPosizioniTableAdapter taAnagPos;
- public DS_magazzinoTableAdapters.StoricoAzioniOperatoreTableAdapter taSAO;
- public DS_magazzinoTableAdapters.AnagLineeTableAdapter taAL;
- public DS_magazzinoTableAdapters.stp_ParticolareInOutOkTableAdapter taPartIO;
- public DS_magazzinoTableAdapters.Attr2UDCTableAdapter taAtt2UDC;
- public DS_magazzinoTableAdapters.ElencoAssiemiTableAdapter taEA;
- public DS_magazzinoTableAdapters.AL2UDCTableAdapter taAL2UDC;
- public DS_magazzinoTableAdapters.ElencoTrattamentiTableAdapter taET;
- public DS_magazzinoTableAdapters.v_A2U2DTableAdapter taA2U2D;
- public DS_magazzinoTableAdapters.UDC_check4deleteTableAdapter taUdcChk4Del;
+ taAnagMag = new GMW_data.DS_magazzinoTableAdapters.AnagMagTableAdapter();
+ taBlocchi = new GMW_data.DS_magazzinoTableAdapters.BlocchiTableAdapter();
+ taCelle = new GMW_data.DS_magazzinoTableAdapters.CelleTableAdapter();
+ taTipoCella = new GMW_data.DS_magazzinoTableAdapters.TipoCellaTableAdapter();
+ taCartellini = new GMW_data.DS_magazzinoTableAdapters.ElencoCartelliniTableAdapter();
+ taPosUdcCorr = new GMW_data.DS_magazzinoTableAdapters.PosizioneUdcCorrenteTableAdapter();
+ taPosUdcStorico = new GMW_data.DS_magazzinoTableAdapters.PosizioneUdcStoricoTableAdapter();
+ taMagOverw = new GMW_data.DS_magazzinoTableAdapters.V_MagazziniOverviewTableAdapter();
+ taDettMagPart = new GMW_data.DS_magazzinoTableAdapters.V_DettMagPartTableAdapter();
+ taDettUDC = new GMW_data.DS_magazzinoTableAdapters.v_UdcDetailTableAdapter();
+ taElencoListePrelievo = new GMW_data.DS_magazzinoTableAdapters.ElencoListePrelievoTableAdapter();
+ taRigheListePrelievo = new GMW_data.DS_magazzinoTableAdapters.RigheListePrelievoTableAdapter();
+ taTipoListaPrelievo = new GMW_data.DS_magazzinoTableAdapters.TipoListaPrelievoTableAdapter();
+ taVParticolariOverwiew = new GMW_data.DS_magazzinoTableAdapters.V_ParticolariOverviewTableAdapter();
+ taPartExpFig = new GMW_data.DS_magazzinoTableAdapters.v_particolariEsponenteFiguraTableAdapter();
+ taStatoCelle = new GMW_data.DS_magazzinoTableAdapters.V_statoCelleCapienzaAssegnatiTableAdapter();
+ taRapQual = new GMW_data.DS_magazzinoTableAdapters.RapQualTableAdapter();
+ taRQ_sunto = new GMW_data.DS_magazzinoTableAdapters.v_RapQualSuntoTableAdapter();
+ taAnagLeghe = new GMW_data.DS_magazzinoTableAdapters.AnagLegheTableAdapter();
+ taPosizDelib = new GMW_data.DS_magazzinoTableAdapters.v_posizioniDelibereTableAdapter();
+ taAnagPart = new GMW_data.DS_magazzinoTableAdapters.AnagParticolariTableAdapter();
+ taAnagPos = new GMW_data.DS_magazzinoTableAdapters.AnagPosizioniTableAdapter();
+ taSAO = new DS_magazzinoTableAdapters.StoricoAzioniOperatoreTableAdapter();
+ taAL = new DS_magazzinoTableAdapters.AnagLineeTableAdapter();
+ taPartIO = new DS_magazzinoTableAdapters.stp_ParticolareInOutOkTableAdapter();
+ taAtt2UDC = new DS_magazzinoTableAdapters.Attr2UDCTableAdapter();
+ taEA = new DS_magazzinoTableAdapters.ElencoAssiemiTableAdapter();
+ taAL2UDC = new DS_magazzinoTableAdapters.AL2UDCTableAdapter();
+ taET = new DS_magazzinoTableAdapters.ElencoTrattamentiTableAdapter();
+ taA2U2D = new DS_magazzinoTableAdapters.v_A2U2DTableAdapter();
+ taUdcChk4Del = new DS_magazzinoTableAdapters.UDC_check4deleteTableAdapter();
+ }
+ ///
+ /// effettua setup dei connection strings da web.config delal singola applicazione
+ ///
+ protected virtual void setupConnectionStringBase()
+ {
+ string connString = memLayer.ML.confReadString("GMWConnectionString");
+ // connections del db
+ taAnagMag.Connection.ConnectionString = connString;
+ taBlocchi.Connection.ConnectionString = connString;
+ taCelle.Connection.ConnectionString = connString;
+ taTipoCella.Connection.ConnectionString = connString;
+ taCartellini.Connection.ConnectionString = connString;
+ taPosUdcCorr.Connection.ConnectionString = connString;
+ taPosUdcStorico.Connection.ConnectionString = connString;
+ taMagOverw.Connection.ConnectionString = connString;
+ taDettMagPart.Connection.ConnectionString = connString;
+ taDettUDC.Connection.ConnectionString = connString;
+ taElencoListePrelievo.Connection.ConnectionString = connString;
+ taRigheListePrelievo.Connection.ConnectionString = connString;
+ taTipoListaPrelievo.Connection.ConnectionString = connString;
+ taVParticolariOverwiew.Connection.ConnectionString = connString;
+ taPartExpFig.Connection.ConnectionString = connString;
+ taStatoCelle.Connection.ConnectionString = connString;
+ taRapQual.Connection.ConnectionString = connString;
+ taRQ_sunto.Connection.ConnectionString = connString;
+ taAnagLeghe.Connection.ConnectionString = connString;
+ taPosizDelib.Connection.ConnectionString = connString;
+ taAnagPart.Connection.ConnectionString = connString;
+ taAnagPos.Connection.ConnectionString = connString;
+ taSAO.Connection.ConnectionString = connString;
+ taAL.Connection.ConnectionString = connString;
+ taPartIO.Connection.ConnectionString = connString;
+ taAtt2UDC.Connection.ConnectionString = connString;
+ taEA.Connection.ConnectionString = connString;
+ taAL2UDC.Connection.ConnectionString = connString;
+ taET.Connection.ConnectionString = connString;
+ taA2U2D.Connection.ConnectionString = connString;
+ taUdcChk4Del.Connection.ConnectionString = connString;
+ }
+ #endregion
- ///
- /// init dei table adapters
- ///
- protected void initTA()
- {
- // istanzio oggetto
+ #region Inizializzazione
- taAnagMag = new GMW_data.DS_magazzinoTableAdapters.AnagMagTableAdapter();
- taBlocchi = new GMW_data.DS_magazzinoTableAdapters.BlocchiTableAdapter();
- taCelle = new GMW_data.DS_magazzinoTableAdapters.CelleTableAdapter();
- taTipoCella = new GMW_data.DS_magazzinoTableAdapters.TipoCellaTableAdapter();
- taCartellini = new GMW_data.DS_magazzinoTableAdapters.ElencoCartelliniTableAdapter();
- taPosUdcCorr = new GMW_data.DS_magazzinoTableAdapters.PosizioneUdcCorrenteTableAdapter();
- taPosUdcStorico = new GMW_data.DS_magazzinoTableAdapters.PosizioneUdcStoricoTableAdapter();
- taMagOverw = new GMW_data.DS_magazzinoTableAdapters.V_MagazziniOverviewTableAdapter();
- taDettMagPart = new GMW_data.DS_magazzinoTableAdapters.V_DettMagPartTableAdapter();
- taDettUDC = new GMW_data.DS_magazzinoTableAdapters.v_UdcDetailTableAdapter();
- taElencoListePrelievo = new GMW_data.DS_magazzinoTableAdapters.ElencoListePrelievoTableAdapter();
- taRigheListePrelievo = new GMW_data.DS_magazzinoTableAdapters.RigheListePrelievoTableAdapter();
- taTipoListaPrelievo = new GMW_data.DS_magazzinoTableAdapters.TipoListaPrelievoTableAdapter();
- taVParticolariOverwiew = new GMW_data.DS_magazzinoTableAdapters.V_ParticolariOverviewTableAdapter();
- taPartExpFig = new GMW_data.DS_magazzinoTableAdapters.v_particolariEsponenteFiguraTableAdapter();
- taStatoCelle = new GMW_data.DS_magazzinoTableAdapters.V_statoCelleCapienzaAssegnatiTableAdapter();
- taRapQual = new GMW_data.DS_magazzinoTableAdapters.RapQualTableAdapter();
- taRQ_sunto = new GMW_data.DS_magazzinoTableAdapters.v_RapQualSuntoTableAdapter();
- taAnagLeghe = new GMW_data.DS_magazzinoTableAdapters.AnagLegheTableAdapter();
- taPosizDelib = new GMW_data.DS_magazzinoTableAdapters.v_posizioniDelibereTableAdapter();
- taAnagPart = new GMW_data.DS_magazzinoTableAdapters.AnagParticolariTableAdapter();
- taAnagPos = new GMW_data.DS_magazzinoTableAdapters.AnagPosizioniTableAdapter();
- taSAO = new DS_magazzinoTableAdapters.StoricoAzioniOperatoreTableAdapter();
- taAL = new DS_magazzinoTableAdapters.AnagLineeTableAdapter();
- taPartIO = new DS_magazzinoTableAdapters.stp_ParticolareInOutOkTableAdapter();
- taAtt2UDC = new DS_magazzinoTableAdapters.Attr2UDCTableAdapter();
- taEA = new DS_magazzinoTableAdapters.ElencoAssiemiTableAdapter();
- taAL2UDC = new DS_magazzinoTableAdapters.AL2UDCTableAdapter();
- taET = new DS_magazzinoTableAdapters.ElencoTrattamentiTableAdapter();
- taA2U2D = new DS_magazzinoTableAdapters.v_A2U2DTableAdapter();
- taUdcChk4Del = new DS_magazzinoTableAdapters.UDC_check4deleteTableAdapter();
- }
- ///
- /// effettua setup dei connection strings da web.config delal singola applicazione
- ///
- protected virtual void setupConnectionStringBase()
- {
- string connString = memLayer.ML.confReadString("GMWConnectionString");
- // connections del db
- taAnagMag.Connection.ConnectionString = connString;
- taBlocchi.Connection.ConnectionString = connString;
- taCelle.Connection.ConnectionString = connString;
- taTipoCella.Connection.ConnectionString = connString;
- taCartellini.Connection.ConnectionString = connString;
- taPosUdcCorr.Connection.ConnectionString = connString;
- taPosUdcStorico.Connection.ConnectionString = connString;
- taMagOverw.Connection.ConnectionString = connString;
- taDettMagPart.Connection.ConnectionString = connString;
- taDettUDC.Connection.ConnectionString = connString;
- taElencoListePrelievo.Connection.ConnectionString = connString;
- taRigheListePrelievo.Connection.ConnectionString = connString;
- taTipoListaPrelievo.Connection.ConnectionString = connString;
- taVParticolariOverwiew.Connection.ConnectionString = connString;
- taPartExpFig.Connection.ConnectionString = connString;
- taStatoCelle.Connection.ConnectionString = connString;
- taRapQual.Connection.ConnectionString = connString;
- taRQ_sunto.Connection.ConnectionString = connString;
- taAnagLeghe.Connection.ConnectionString = connString;
- taPosizDelib.Connection.ConnectionString = connString;
- taAnagPart.Connection.ConnectionString = connString;
- taAnagPos.Connection.ConnectionString = connString;
- taSAO.Connection.ConnectionString = connString;
- taAL.Connection.ConnectionString = connString;
- taPartIO.Connection.ConnectionString = connString;
- taAtt2UDC.Connection.ConnectionString = connString;
- taEA.Connection.ConnectionString = connString;
- taAL2UDC.Connection.ConnectionString = connString;
- taET.Connection.ConnectionString = connString;
- taA2U2D.Connection.ConnectionString = connString;
- taUdcChk4Del.Connection.ConnectionString = connString;
- }
+ public MagClass()
+ {
+ initTA();
+ setupConnectionStringBase();
- #endregion
+ // aggiunta x gestione timeout esteso (ove necessario)!
+ fixCommandTimeout();
+ }
- #region Inizializzazione
+ ///
+ /// sistemazione timeout comandi nei tableadapter
+ ///
+ private void fixCommandTimeout()
+ {
+ SetAllCommandTimeouts(taCartellini, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
+ SetAllCommandTimeouts(taPosUdcCorr, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
+ SetAllCommandTimeouts(taElencoListePrelievo, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
+ }
+ void SetAllCommandTimeouts(object adapter, int timeout)
+ {
+ var commands = adapter.GetType().InvokeMember(
+ "CommandCollection",
+ BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
+ null, adapter, new object[0]);
+ var sqlCommand = (SqlCommand[])commands;
+ foreach (var cmd in sqlCommand)
+ {
+ cmd.CommandTimeout = timeout;
+ }
+ }
- public MagClass()
- {
- initTA();
- setupConnectionStringBase();
+ ///
+ /// oggetto static per fare chiamate sul magazzino
+ ///
+ public static MagClass magazzino = new MagClass();
- // aggiunta x gestione timeout esteso (ove necessario)!
- fixCommandTimeout();
- }
+ #endregion
- ///
- /// sistemazione timeout comandi nei tableadapter
- ///
- private void fixCommandTimeout()
- {
- SetAllCommandTimeouts(taCartellini, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
- SetAllCommandTimeouts(taPosUdcCorr, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
- SetAllCommandTimeouts(taElencoListePrelievo, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
- }
- void SetAllCommandTimeouts(object adapter, int timeout)
- {
- var commands = adapter.GetType().InvokeMember(
- "CommandCollection",
- BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
- null, adapter, new object[0]);
- var sqlCommand = (SqlCommand[])commands;
- foreach (var cmd in sqlCommand)
+ #region metodi protected
+
+ ///
+ /// aggiunge le righe liste di prelievo necessarie a soddisfare la richiesta in logica FIFO dato un elenco di cartellini, la qta totale da allocare e la lista attuale
+ ///
+ ///
+ ///
+ ///
+ private void allocaRigheListaPrelievo(decimal QtaTot, string codListaAttuale, DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini)
+ {
+ //ricavo il valore UDC della riga del più vecchio
+ string udcAttuale;
+ bool qtaOk = false;
+ bool dataFinished = false;
+ int progrUdc = 0;
+ int numUdcDisponibili = tabellaElencoCartellini.Rows.Count;
+ // contiene la quantità della riga attuale
+ decimal qtaRiga;
+ // somma progressiva della qta allocata - calcolo da db!
+ decimal qtaAllocata = taElencoListePrelievo.getByCodLista(codListaAttuale)[0].Prelevato;
+ //ciclo WHILE per lo riempimento FIFO con UDC secondo richiesta a partire da elenco fornito
+ while (!qtaOk && !dataFinished)
+ {
+ /*
+ * crea una riga in righelistaprelievo passando come valori
+ * il codlista attuale ricavato da sopr
+ * l'UDC dal primo della tabella getOlderUDC
+ *
+ *
+ * recupero quantità dalla riga corrente;
+ *
+ * imposto proposto a 1;
+ * imposto prelevato 0;
+ * taRighelistePreliveo.Insert;
+ *
+ * qtaAllocata = qtaAllocata + Qta di questa riga (riuso il valore della colonna QTA
+ * tabella[contatore]; contatore++;
+ * qtaOk = (qtaAllocata >= qtaRichiesta)
+ * dataFinished = (contatore >= numRighe);
+ *
+ * */
+ // ricavo la riga più vecchia
+ qtaRiga = tabellaElencoCartellini[progrUdc].Qta;
+ udcAttuale = tabellaElencoCartellini[progrUdc].UDC;
+ // eseguo query di insert
+ taRigheListePrelievo.Insert(codListaAttuale, udcAttuale, qtaRiga, true, false);
+
+ //incremento qta allocata
+ qtaAllocata = (qtaAllocata + qtaRiga);
+ //incremento contatore
+ progrUdc++;
+
+ // verifico le condizioni, false se non cambia nulla true se cambia e si esce dal while
+ qtaOk = (qtaAllocata >= QtaTot);
+ dataFinished = (progrUdc >= numUdcDisponibili);
+ }
+ }
+
+ #endregion
+
+ #region Metodi esposti
+
+ #region operazioni su AL
+
+ ///
+ /// Fornisce un nuovo codice AL tipo completo a partire dalla richiesta e salva i dati
+ ///
+ /// tipologia dell'AL da generare
+ /// codice della cella contentente gli UDC da associare
+ /// codice dell'operatore
+ /// anno in cui intestare i cartellini, trimma a 2 cifre DX
+ /// codice cesta
+ /// note da associare agli UDC
+ /// AL del nuovo Assieme Logico e lo associa agli UDC della postazione/cella
+ public string creaAssociaAlRxNt(tipoAL tipologia, string CodCella, string CodSoggetto, int anno, string Cesta, string note)
+ {
+ // imposto valori default
+ string CodCS = memLayer.ML.cdv("CodCS");
+ string PostFlux = "";
+ string CodFlusso = "";
+ string TipoAL = "";
+ string CodEvento = "";
+ string CodDtxStart = "";
+ string CodDtxEnd = "";
+ switch (tipologia)
+ {
+ case tipoAL.AL_RxDt:
+ PostFlux = "RxDt";
+ CodFlusso = "AR";
+ TipoAL = "R";
+ CodEvento = "UDC_RX_DT";
+ // calcolo primo/ultimo dtx OK
+ try
+ {
+ DS_DataMatrix.stp_getFirstLastDtxRow rigaFirstLast = DataMatrix.mgr.taFirstLastUdc.GetData(CodCella)[0];
+ if (!rigaFirstLast.IsNull(0))
{
- cmd.CommandTimeout = timeout;
- }
- }
-
- ///
- /// oggetto static per fare chiamate sul magazzino
- ///
- public static MagClass magazzino = new MagClass();
-
- #endregion
-
- #region metodi protected
-
- ///
- /// aggiunge le righe liste di prelievo necessarie a soddisfare la richiesta in logica FIFO dato un elenco di cartellini, la qta totale da allocare e la lista attuale
- ///
- ///
- ///
- ///
- private void allocaRigheListaPrelievo(decimal QtaTot, string codListaAttuale, DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini)
- {
- //ricavo il valore UDC della riga del più vecchio
- string udcAttuale;
- bool qtaOk = false;
- bool dataFinished = false;
- int progrUdc = 0;
- int numUdcDisponibili = tabellaElencoCartellini.Rows.Count;
- // contiene la quantità della riga attuale
- decimal qtaRiga;
- // somma progressiva della qta allocata - calcolo da db!
- decimal qtaAllocata = taElencoListePrelievo.getByCodLista(codListaAttuale)[0].Prelevato;
- //ciclo WHILE per lo riempimento FIFO con UDC secondo richiesta a partire da elenco fornito
- while (!qtaOk && !dataFinished)
- {
- /*
- * crea una riga in righelistaprelievo passando come valori
- * il codlista attuale ricavato da sopr
- * l'UDC dal primo della tabella getOlderUDC
- *
- *
- * recupero quantità dalla riga corrente;
- *
- * imposto proposto a 1;
- * imposto prelevato 0;
- * taRighelistePreliveo.Insert;
- *
- * qtaAllocata = qtaAllocata + Qta di questa riga (riuso il valore della colonna QTA
- * tabella[contatore]; contatore++;
- * qtaOk = (qtaAllocata >= qtaRichiesta)
- * dataFinished = (contatore >= numRighe);
- *
- * */
- // ricavo la riga più vecchia
- qtaRiga = tabellaElencoCartellini[progrUdc].Qta;
- udcAttuale = tabellaElencoCartellini[progrUdc].UDC;
- // eseguo query di insert
- taRigheListePrelievo.Insert(codListaAttuale, udcAttuale, qtaRiga, true, false);
-
- //incremento qta allocata
- qtaAllocata = (qtaAllocata + qtaRiga);
- //incremento contatore
- progrUdc++;
-
- // verifico le condizioni, false se non cambia nulla true se cambia e si esce dal while
- qtaOk = (qtaAllocata >= QtaTot);
- dataFinished = (progrUdc >= numUdcDisponibili);
- }
- }
-
- #endregion
-
- #region Metodi esposti
-
- #region operazioni su AL
-
- ///
- /// Fornisce un nuovo codice AL tipo completo a partire dalla richiesta e salva i dati
- ///
- /// tipologia dell'AL da generare
- /// codice della cella contentente gli UDC da associare
- /// codice dell'operatore
- /// anno in cui intestare i cartellini, trimma a 2 cifre DX
- /// codice cesta
- /// note da associare agli UDC
- /// AL del nuovo Assieme Logico e lo associa agli UDC della postazione/cella
- public string creaAssociaAlRxNt(tipoAL tipologia, string CodCella, string CodSoggetto, int anno, string Cesta, string note)
- {
- // imposto valori default
- string CodCS = memLayer.ML.cdv("CodCS");
- string PostFlux = "";
- string CodFlusso = "";
- string TipoAL = "";
- string CodEvento = "";
- string CodDtxStart = "";
- string CodDtxEnd = "";
- switch (tipologia)
- {
- case tipoAL.AL_RxDt:
- PostFlux = "RxDt";
- CodFlusso = "AR";
- TipoAL = "R";
- CodEvento = "UDC_RX_DT";
- // calcolo primo/ultimo dtx OK
- try
- {
- DS_DataMatrix.stp_getFirstLastDtxRow rigaFirstLast = DataMatrix.mgr.taFirstLastUdc.GetData(CodCella)[0];
- if (!rigaFirstLast.IsNull(0))
- {
- CodDtxStart = rigaFirstLast.DtxStart;
- CodDtxEnd = rigaFirstLast.DtxEnd;
- }
- else
- {
- CodDtxStart = "";
- CodDtxEnd = "";
- }
- }
- catch
- {
- CodDtxStart = "";
- CodDtxEnd = "";
- }
- break;
- case tipoAL.AL_RxNt:
- PostFlux = "RxNt";
- CodFlusso = "AR";
- TipoAL = "R";
- CodEvento = "UDC_RX";
- break;
- default:
- break;
- }
- DateTime DataRif = DateTime.Now;
- // trim fix
- string CodSoggettoTrim = CodSoggetto.Trim();
- string annoTrim = anno.ToString();
- if (annoTrim.Length > 2)
- {
- annoTrim = annoTrim.Substring(2, 2);
- }
- // out: codice AL...
- string AL = "NA";
- // creo nuovo Assieme Logico ed associo UDC!
- try
- {
- taEA.insertNewRX(CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEvento, note, ref AL);
- }
- catch (Exception exc)
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE CREAZIONE AL: {0} procedura stp_UAL_insertNewRX, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} {0} {14}", Environment.NewLine, CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEvento, note, exc), tipoLog.EXCEPTION);
- }
- return AL;
- }
-
- ///
- /// Fornisce un nuovo codice AL tipo completo a partire dalla richiesta e salva i dati
- ///
- /// Codice Linea
- /// Formato DataMatrix
- /// CodEvento creazione UDC
- /// CodEvento creazione UDC
- /// tipologia dell'AL da generare
- /// codice della cella contentente gli UDC da associare
- /// codice dell'operatore
- /// anno in cui intestare i cartellini, trimma a 2 cifre DX
- /// codice cesta
- /// note da associare agli UDC
- /// AL del nuovo Assieme Logico e lo associa agli UDC della postazione/cella
- public string creaAssociaAlUdcRxDt(string CodLinea, string FormatoDtmx, string CodEventoUdc, string CodStatoUdc, tipoAL tipologia, string CodCella, string CodSoggetto, int anno, string Cesta, string note)
- {
- // imposto valori default
- string CodCS = memLayer.ML.cdv("CodCS");
- string PostFlux = "";
- string CodFlusso = "";
- string CodFlussoUdc = "";
- string TipoAL = "";
- string CodDtxStart = "";
- string CodDtxEnd = "";
- switch (tipologia)
- {
- case tipoAL.AL_RxDt:
- PostFlux = "RxDt";
- CodFlusso = "AR";
- CodFlussoUdc = "RX";
- TipoAL = "R";
- // calcolo primo/ultimo dtx OK
- try
- {
- DS_DataMatrix.stp_getFirstLastDtxRow rigaFirstLast = DataMatrix.mgr.taFirstLastUdc.GetData(CodCella)[0];
- if (!rigaFirstLast.IsNull(0))
- {
- CodDtxStart = rigaFirstLast.DtxStart;
- CodDtxEnd = rigaFirstLast.DtxEnd;
- }
- else
- {
- CodDtxStart = "";
- CodDtxEnd = "";
- }
- }
- catch
- {
- CodDtxStart = "";
- CodDtxEnd = "";
- }
- break;
- default:
- break;
- }
- DateTime DataRif = DateTime.Now;
- // trim fix
- string CodSoggettoTrim = CodSoggetto.Trim();
- string annoTrim = anno.ToString();
- if (annoTrim.Length > 2)
- {
- annoTrim = annoTrim.Substring(2, 2);
- }
- // out: codice AL...
- string AL = "NA";
- // creo nuovo Assieme Logico ed associo UDC!
- try
- {
-
-
- DataMatrix.mgr.taL2D.createUdcAl(CodLinea, FormatoDtmx, CodFlusso, TipoAL, Cesta, CodCS, CodFlussoUdc, annoTrim, "", "", "", "", "", DataRif, 0, memLayer.ML.cdv("CodImballoRX"), CodSoggettoTrim, 0, memLayer.ML.cdvi("IdxPosizioneRxTemp"), "U", CodEventoUdc, 0, 0, CodStatoUdc, "", false, note);
- // vado a leggere AL da riga corrente
- AL = DataMatrix.mgr.taL2D.getByLineFormato(Postazione.currCodLinea, FormatoDtmx)[0].AL;
-
- }
- catch (Exception exc)
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE CREAZIONE AL: {0} procedura dmtx.stp_L2D_createUdc, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} {0} {14}", Environment.NewLine, CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEventoUdc, note, exc), tipoLog.EXCEPTION);
- }
- return AL;
- }
-
- ///
- /// Crea un nuovo AL di tipo TT a partire da uno RX e sistema di conseguenza UDC ed eventuali Dtx
- ///
- /// Codice AL RX sorgente
- /// tipologia (T)
- /// Operatore
- /// Note
- /// Numero Trattamento
- /// Durezza rilevata
- /// Codice Punzone da utilizzare (se indicato)
- ///
- public string creaAssociaAlTT(string SourceAL, tipoAL tipologia, string CodSoggetto, string note, string NumTratt, int Durezza, string punzone)
- {
- // imposto valori default
- string TipoAL = "";
- string CodEvento = "";
- DateTime DataRif = DateTime.Now;
- // trim fix
- string CodSoggettoTrim = CodSoggetto.Trim();
- // out: codice AL...
- string AL = "NA";
- switch (tipologia)
- {
- case tipoAL.AL_TT:
- TipoAL = "T";
- CodEvento = "UDC_TRATT";
- break;
- default:
- break;
- }
- // creo nuovo Assieme Logico ed associo UDC!
- try
- {
- taEA.insertNewTT(SourceAL, TipoAL, DataRif, CodSoggetto, note, NumTratt, Durezza, punzone, ref AL);
- }
- catch (Exception exc)
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE avanzamento AL TT: {0} procedura stp_UAL_insertNewTT, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {0} {7}", Environment.NewLine, SourceAL, TipoAL, DataRif, CodSoggetto, CodEvento, note, exc), tipoLog.EXCEPTION);
- }
- return AL;
- }
- ///
- /// Crea un nuovo AL di tipo TL a partire da uno TT e sistema di conseguenza UDC ed eventuali Dtx
- ///
- /// Codice AL TT sorgente
- /// tipologia (L)
- /// codice cella di destinazione
- /// Operatore
- ///
- public string creaAssociaAlTL(string SourceAL, tipoAL tipologia, string CodSoggetto, string CodCella)
- {
- // imposto valori default
- string TipoAL = "";
- DateTime DataRif = DateTime.Now;
- // trim fix
- string CodSoggettoTrim = CodSoggetto.Trim();
- // out: codice AL...
- string AL = "NA";
- switch (tipologia)
- {
- case tipoAL.AL_LI:
- TipoAL = "L";
- break;
- default:
- break;
- }
- // creo nuovo Assieme Logico ed associo UDC!
- try
- {
- taEA.insertNewTL(SourceAL, TipoAL, DataRif, CodSoggetto, CodCella, ref AL);
- }
- catch (Exception exc)
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE avanzamento AL TL: {0} procedura stp_UAL_insertNewTL, parametri: {1} | {2} | {3} | {4} | {0} {5}", Environment.NewLine, SourceAL, TipoAL, DataRif, CodSoggetto, exc), tipoLog.EXCEPTION);
- }
- return AL;
- }
- ///
- /// elimina un AL che sia vuoto (da datamatrix)
- ///
- ///
- ///
- ///
- public bool eliminaEmptyAL(string AL, string CodSoggetto)
- {
- bool answ = false;
- try
- {
- taEA.eliminaEmpty(AL, DateTime.Now, CodSoggetto);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in eliminazione AL non vuoto: {0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- return answ;
- }
-
- ///
- /// verifica se l'AL indicato sia valido, ovvero esistente
- ///
- ///
- ///
- public bool checkAL(string AL)
- {
- bool answ = false;
- try
- {
- answ = (taEA.getByAL(AL).Rows.Count > 0);
- }
- catch
- { }
- return answ;
- }
- ///
- /// travasa gli UDC / datamatrix tra 2 AL
- ///
- /// Codice AL sorgente
- /// Codice AL destinazione
- /// IP del chiamante
- /// esito comando
- public bool travasoAL(string ALFrom, string ALDest, string clientIp)
- {
- bool answ = false;
- try
- {
- taAL2UDC.moveUdcDtx(ALFrom, ALDest, CodSoggCurrUser);
- logger.lg.scriviLog(string.Format(" | {0} | travaso UDC: da {1} a {2} | soggetto {3}", clientIp, ALFrom, ALDest, CodSoggCurrUser), tipoLog.INFO);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// effettua la stampa di un dato AL
- ///
- /// Codice AL
- /// stampante specifica (da postazione o std da webconfig, a cura dell'utente)
- /// IP del chiamante
- ///
- public bool stampaAL(string AL, string printer, string clientIp)
- {
- bool answ = false;
- tipoCartellino tipoCart = tipoCartellino.cartAL;
- // controllo se esista UDC
- if (checkAL(AL))
- {
- // in base al codice AL scelgo il tipo di cartellino...
- switch (verificaTipoAl(AL))
- {
- case tipoAL.AL_RX:
- case tipoAL.AL_RxDt:
- case tipoAL.AL_RxNt:
- tipoCart = tipoCartellino.cartALRX;
- break;
- case tipoAL.AL_TT:
- tipoCart = tipoCartellino.cartALTT;
- break;
- case tipoAL.AL_LI:
- case tipoAL.ND:
- default:
- tipoCart = tipoCartellino.cartAL;
- break;
- }
- answ = reportPrinter.obj.stampaCartellino(tipoCart, AL, printer);
- logger.lg.scriviLog(string.Format(" | {0} | stampato AL {1} | stampante {2} | tipo {3}", clientIp, AL, printer, tipoCart), tipoLog.INFO);
+ CodDtxStart = rigaFirstLast.DtxStart;
+ CodDtxEnd = rigaFirstLast.DtxEnd;
}
else
{
- logger.lg.scriviLog(string.Format("ERRORE: non e' stato possibile stampare AL richiesto poiche' non trovato: | IP: {0} | AL {1} | stampante {2} | tipo {3}", clientIp, AL, printer, tipoCart), tipoLog.INFO);
+ CodDtxStart = "";
+ CodDtxEnd = "";
}
- return answ;
- }
- ///
- /// verifica il tipo di AL dato il codice
- ///
- ///
- ///
- public tipoAL verificaTipoAl(string AL)
- {
- tipoAL answ = tipoAL.ND;
- if (AL.StartsWith("ALR"))
+ }
+ catch
+ {
+ CodDtxStart = "";
+ CodDtxEnd = "";
+ }
+ break;
+ case tipoAL.AL_RxNt:
+ PostFlux = "RxNt";
+ CodFlusso = "AR";
+ TipoAL = "R";
+ CodEvento = "UDC_RX";
+ break;
+ default:
+ break;
+ }
+ DateTime DataRif = DateTime.Now;
+ // trim fix
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ string annoTrim = anno.ToString();
+ if (annoTrim.Length > 2)
+ {
+ annoTrim = annoTrim.Substring(2, 2);
+ }
+ // out: codice AL...
+ string AL = "NA";
+ // creo nuovo Assieme Logico ed associo UDC!
+ try
+ {
+ taEA.insertNewRX(CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEvento, note, ref AL);
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE CREAZIONE AL: {0} procedura stp_UAL_insertNewRX, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} {0} {14}", Environment.NewLine, CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEvento, note, exc), tipoLog.EXCEPTION);
+ }
+ return AL;
+ }
+
+ ///
+ /// Fornisce un nuovo codice AL tipo completo a partire dalla richiesta e salva i dati
+ ///
+ /// Codice Linea
+ /// Formato DataMatrix
+ /// CodEvento creazione UDC
+ /// CodEvento creazione UDC
+ /// tipologia dell'AL da generare
+ /// codice della cella contentente gli UDC da associare
+ /// codice dell'operatore
+ /// anno in cui intestare i cartellini, trimma a 2 cifre DX
+ /// codice cesta
+ /// note da associare agli UDC
+ /// AL del nuovo Assieme Logico e lo associa agli UDC della postazione/cella
+ public string creaAssociaAlUdcRxDt(string CodLinea, string FormatoDtmx, string CodEventoUdc, string CodStatoUdc, tipoAL tipologia, string CodCella, string CodSoggetto, int anno, string Cesta, string note)
+ {
+ // imposto valori default
+ string CodCS = memLayer.ML.cdv("CodCS");
+ string PostFlux = "";
+ string CodFlusso = "";
+ string CodFlussoUdc = "";
+ string TipoAL = "";
+ string CodDtxStart = "";
+ string CodDtxEnd = "";
+ switch (tipologia)
+ {
+ case tipoAL.AL_RxDt:
+ PostFlux = "RxDt";
+ CodFlusso = "AR";
+ CodFlussoUdc = "RX";
+ TipoAL = "R";
+ // calcolo primo/ultimo dtx OK
+ try
+ {
+ DS_DataMatrix.stp_getFirstLastDtxRow rigaFirstLast = DataMatrix.mgr.taFirstLastUdc.GetData(CodCella)[0];
+ if (!rigaFirstLast.IsNull(0))
{
- answ = tipoAL.AL_RX;
- }
- else if (AL.StartsWith("ALT"))
- {
- answ = tipoAL.AL_TT;
- }
- else if (AL.StartsWith("ALL"))
- {
- answ = tipoAL.AL_LI;
+ CodDtxStart = rigaFirstLast.DtxStart;
+ CodDtxEnd = rigaFirstLast.DtxEnd;
}
else
{
- answ = tipoAL.ND;
+ CodDtxStart = "";
+ CodDtxEnd = "";
}
- return answ;
+ }
+ catch
+ {
+ CodDtxStart = "";
+ CodDtxEnd = "";
+ }
+ break;
+ default:
+ break;
+ }
+ DateTime DataRif = DateTime.Now;
+ // trim fix
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ string annoTrim = anno.ToString();
+ if (annoTrim.Length > 2)
+ {
+ annoTrim = annoTrim.Substring(2, 2);
+ }
+ // out: codice AL...
+ string AL = "NA";
+ // creo nuovo Assieme Logico ed associo UDC!
+ try
+ {
+
+
+ DataMatrix.mgr.taL2D.createUdcAl(CodLinea, FormatoDtmx, CodFlusso, TipoAL, Cesta, CodCS, CodFlussoUdc, annoTrim, "", "", "", "", "", DataRif, 0, memLayer.ML.cdv("CodImballoRX"), CodSoggettoTrim, 0, memLayer.ML.cdvi("IdxPosizioneRxTemp"), "U", CodEventoUdc, 0, 0, CodStatoUdc, "", false, note);
+ // vado a leggere AL da riga corrente
+ AL = DataMatrix.mgr.taL2D.getByLineFormato(Postazione.currCodLinea, FormatoDtmx)[0].AL;
+
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE CREAZIONE AL: {0} procedura dmtx.stp_L2D_createUdc, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} {0} {14}", Environment.NewLine, CodCS, annoTrim, Cesta, PostFlux, CodFlusso, TipoAL, DataRif, CodSoggettoTrim, CodDtxStart, CodDtxEnd, CodCella, CodEventoUdc, note, exc), tipoLog.EXCEPTION);
+ }
+ return AL;
+ }
+
+ ///
+ /// Crea un nuovo AL di tipo TT a partire da uno RX e sistema di conseguenza UDC ed eventuali Dtx
+ ///
+ /// Codice AL RX sorgente
+ /// tipologia (T)
+ /// Operatore
+ /// Note
+ /// Numero Trattamento
+ /// Durezza rilevata
+ /// Codice Punzone da utilizzare (se indicato)
+ ///
+ public string creaAssociaAlTT(string SourceAL, tipoAL tipologia, string CodSoggetto, string note, string NumTratt, int Durezza, string punzone)
+ {
+ // imposto valori default
+ string TipoAL = "";
+ string CodEvento = "";
+ DateTime DataRif = DateTime.Now;
+ // trim fix
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ // out: codice AL...
+ string AL = "NA";
+ switch (tipologia)
+ {
+ case tipoAL.AL_TT:
+ TipoAL = "T";
+ CodEvento = "UDC_TRATT";
+ break;
+ default:
+ break;
+ }
+ // creo nuovo Assieme Logico ed associo UDC!
+ try
+ {
+ taEA.insertNewTT(SourceAL, TipoAL, DataRif, CodSoggetto, note, NumTratt, Durezza, punzone, ref AL);
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE avanzamento AL TT: {0} procedura stp_UAL_insertNewTT, parametri: {1} | {2} | {3} | {4} | {5} | {6} | {0} {7}", Environment.NewLine, SourceAL, TipoAL, DataRif, CodSoggetto, CodEvento, note, exc), tipoLog.EXCEPTION);
+ }
+ return AL;
+ }
+ ///
+ /// Crea un nuovo AL di tipo TL a partire da uno TT e sistema di conseguenza UDC ed eventuali Dtx
+ ///
+ /// Codice AL TT sorgente
+ /// tipologia (L)
+ /// codice cella di destinazione
+ /// Operatore
+ ///
+ public string creaAssociaAlTL(string SourceAL, tipoAL tipologia, string CodSoggetto, string CodCella)
+ {
+ // imposto valori default
+ string TipoAL = "";
+ DateTime DataRif = DateTime.Now;
+ // trim fix
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ // out: codice AL...
+ string AL = "NA";
+ switch (tipologia)
+ {
+ case tipoAL.AL_LI:
+ TipoAL = "L";
+ break;
+ default:
+ break;
+ }
+ // creo nuovo Assieme Logico ed associo UDC!
+ try
+ {
+ taEA.insertNewTL(SourceAL, TipoAL, DataRif, CodSoggetto, CodCella, ref AL);
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE avanzamento AL TL: {0} procedura stp_UAL_insertNewTL, parametri: {1} | {2} | {3} | {4} | {0} {5}", Environment.NewLine, SourceAL, TipoAL, DataRif, CodSoggetto, exc), tipoLog.EXCEPTION);
+ }
+ return AL;
+ }
+ ///
+ /// elimina un AL che sia vuoto (da datamatrix)
+ ///
+ ///
+ ///
+ ///
+ public bool eliminaEmptyAL(string AL, string CodSoggetto)
+ {
+ bool answ = false;
+ try
+ {
+ taEA.eliminaEmpty(AL, DateTime.Now, CodSoggetto);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in eliminazione AL non vuoto: {0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+
+ ///
+ /// verifica se l'AL indicato sia valido, ovvero esistente
+ ///
+ ///
+ ///
+ public bool checkAL(string AL)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (taEA.getByAL(AL).Rows.Count > 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// travasa gli UDC / datamatrix tra 2 AL
+ ///
+ /// Codice AL sorgente
+ /// Codice AL destinazione
+ /// IP del chiamante
+ /// esito comando
+ public bool travasoAL(string ALFrom, string ALDest, string clientIp)
+ {
+ bool answ = false;
+ try
+ {
+ taAL2UDC.moveUdcDtx(ALFrom, ALDest, CodSoggCurrUser);
+ logger.lg.scriviLog(string.Format(" | {0} | travaso UDC: da {1} a {2} | soggetto {3}", clientIp, ALFrom, ALDest, CodSoggCurrUser), tipoLog.INFO);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// effettua la stampa di un dato AL
+ ///
+ /// Codice AL
+ /// stampante specifica (da postazione o std da webconfig, a cura dell'utente)
+ /// IP del chiamante
+ ///
+ public bool stampaAL(string AL, string printer, string clientIp)
+ {
+ bool answ = false;
+ tipoCartellino tipoCart = tipoCartellino.cartAL;
+ // controllo se esista UDC
+ if (checkAL(AL))
+ {
+ // in base al codice AL scelgo il tipo di cartellino...
+ switch (verificaTipoAl(AL))
+ {
+ case tipoAL.AL_RX:
+ case tipoAL.AL_RxDt:
+ case tipoAL.AL_RxNt:
+ tipoCart = tipoCartellino.cartALRX;
+ break;
+ case tipoAL.AL_TT:
+ tipoCart = tipoCartellino.cartALTT;
+ break;
+ case tipoAL.AL_LI:
+ case tipoAL.ND:
+ default:
+ tipoCart = tipoCartellino.cartAL;
+ break;
+ }
+ answ = reportPrinter.obj.stampaCartellino(tipoCart, AL, printer);
+ logger.lg.scriviLog(string.Format(" | {0} | stampato AL {1} | stampante {2} | tipo {3}", clientIp, AL, printer, tipoCart), tipoLog.INFO);
+ }
+ else
+ {
+ logger.lg.scriviLog(string.Format("ERRORE: non e' stato possibile stampare AL richiesto poiche' non trovato: | IP: {0} | AL {1} | stampante {2} | tipo {3}", clientIp, AL, printer, tipoCart), tipoLog.INFO);
+ }
+ return answ;
+ }
+ ///
+ /// verifica il tipo di AL dato il codice
+ ///
+ ///
+ ///
+ public tipoAL verificaTipoAl(string AL)
+ {
+ tipoAL answ = tipoAL.ND;
+ if (AL.StartsWith("ALR"))
+ {
+ answ = tipoAL.AL_RX;
+ }
+ else if (AL.StartsWith("ALT"))
+ {
+ answ = tipoAL.AL_TT;
+ }
+ else if (AL.StartsWith("ALL"))
+ {
+ answ = tipoAL.AL_LI;
+ }
+ else
+ {
+ answ = tipoAL.ND;
+ }
+ return answ;
+ }
+
+ #endregion
+
+ #region operazioni su UDC
+
+ ///
+ /// effettua lo spostamento di un UDC tra 2 posizioni indicate
+ ///
+ /// Codice company/sito
+ /// Codice UDC
+ /// Cella di destinazione
+ /// indica se sia richiesto resettare le Righe Liste Prelievo con lo spostsamento
+ /// IP del chiamante
+ /// esito comando
+ public bool spostaUDC(string CodCS, string UDC, int IdxCellaTo, bool resetRLP, string clientIp)
+ {
+ bool answ = false;
+ // procedo SOLO se la cella di dest è VUOTA...
+ if (!MagClass.magazzino.cellaPiena(CodCS, IdxCellaTo))
+ {
+ try
+ {
+ taPosUdcCorr.stp_spostaUdc(CodCS, UDC, IdxCellaTo, resetRLP, CodSoggCurrUser);
+ // cerco nuova posizione...
+ if (taPosUdcCorr.getByCellaUdc(UDC, IdxCellaTo).Rows.Count > 0)
+ {
+ answ = true;
+ }
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {1} | Errore durante spostamento cella: {0}", e, clientIp), tipoLog.EXCEPTION);
+ }
+ // solo se ha fatto spostamento posizione corrente verifico se fare spostamento in posizione LOGICA magazzino
+ if (answ)
+ {
+ try
+ {
+ // verifico tipo cella e se ci sia da fare spostamento in mag logico/contabile
+ int idxTipoCella = taCelle.getByIdxCella(IdxCellaTo)[0].IdxTipoCella;
+ bool needSetMag = taTipoCella.getByIdx(idxTipoCella)[0].SetMag;
+ if (needSetMag)
+ {
+ // cambio (eventualmente) la posizione "logica" dato lo spostamento (il codice magazzino...)
+ int idxBlocco = taCelle.getByIdxCella(IdxCellaTo)[0].IdxBlocco;
+ int IdxPosizione = Convert.ToInt32(taBlocchi.getByIdx(idxBlocco)[0].CodMag);
+ taCartellini.updateIdxPosizione(UDC, IdxPosizione, CodSoggCurrUser);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {1} | Errore durante indicazione posizione UDC: {0}", e, clientIp), tipoLog.EXCEPTION);
+ }
+ }
+ }
+ else
+ {
+ logger.lg.scriviLog(string.Format(" | {1} | Errore, cella {0} di destinazione piena!!!", IdxCellaTo, clientIp), tipoLog.ERROR);
+ }
+ return answ;
+ }
+ ///
+ /// effettua lo scaricamento di un UDC (x spedizione)
+ ///
+ /// Codice UDC
+ /// Codice posizione UDC finale
+ /// Codice evento associato allo scaricamento
+ /// IP del chiamante
+ /// esito comando
+ public bool scaricaUDC(string UDC, int IdxPosizUdc, string CodEvento, string clientIp)
+ {
+ bool answ = false;
+ try
+ {
+ taPosUdcCorr.stp_scaricaUdc(UDC, IdxPosizUdc, CodEvento, CodSoggCurrUser);
+ logger.lg.scriviLog(string.Format(" | {0} | Scaricato UDC {1} | posizione {2} | CodEvento {3} | soggetto {4}", clientIp, UDC, IdxPosizUdc, CodEvento, CodSoggCurrUser), tipoLog.INFO);
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format(" | {2} | Errore in scaricaUDC:{0}{1}", Environment.NewLine, exc, clientIp), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ ///
+ /// rettifica la qta di un UDC
+ ///
+ /// Codice UDC
+ /// Nuova quantita associata
+ /// IP del chiamante
+ /// esito comando
+ public bool rettificaQtaUDC(string UDC, decimal qta, string clientIp)
+ {
+ bool answ = false;
+ try
+ {
+ int fatti = 0;
+ fatti = taCartellini.updateQty(UDC, CodSoggCurrUser, "U", "UDC_QTY", qta).Rows.Count;
+ if (fatti > 0)
+ {
+ answ = true;
+ logger.lg.scriviLog(string.Format(" | {0} | Rettifica qta UDC {1} | qta {2} | soggetto {3}", clientIp, UDC, qta, CodSoggCurrUser), tipoLog.INFO);
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// rettifica la qta di un UDC
+ ///
+ /// Codice UDC sorgente
+ /// Codice UDC destinazione
+ /// Quantita da travasare
+ /// IP del chiamante
+ /// esito comando
+ public bool travasoQtaUDC(string UdcFrom, string UdcDest, decimal qta, string clientIp)
+ {
+ bool answ = false;
+ try
+ {
+ taCartellini.travasoQty(UdcFrom, UdcDest, CodSoggCurrUser, "U", "UDC_TraQTY", qta);
+ logger.lg.scriviLog(string.Format(" | {0} | travaso qta UDC: da {1} a {2} | qta {3} | soggetto {4}", clientIp, UdcFrom, UdcDest, qta, CodSoggCurrUser), tipoLog.INFO);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Sistema il cartellino finito liquidi per la stampa
+ ///
+ /// AL sorgente in postazione (ATL)
+ /// Tipo cart da legare (TT)
+ /// Cod UDC da processare
+ /// Cod Imballo
+ /// Note x cartellino
+ /// Cod soggetto
+ ///
+ public bool liquidiFullUpdate(string SourceAL, string TipoAlAnc, string UDC, string CodImb, string Note, string CodSoggetto)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcLiqFullUpdate(SourceAL, TipoAlAnc, UDC, CodImb, Note, DateTime.Now, CodSoggetto)[0];
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Riprende in carico alla postazione un cartellino liquidi FINITO valido
+ ///
+ /// Cod UDC da processare
+ /// Cod soggetto
+ /// AL (temporaneo) di destinazione
+ /// Cod cella di destinazione
+ ///
+ public bool liquidiRiprendiInCaricoUDC(string UDC, string CodSoggetto, string tempAL, int idxCella)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcLiqRicarica(UDC, idxCella, tempAL, DateTime.Now, CodSoggetto)[0];
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ ///
+ /// Riprende in carico alla postazione un cartellino Finiti Rx valido
+ ///
+ /// Cod UDC da processare
+ /// Cod soggetto
+ /// AL (temporaneo) di destinazione
+ /// Cod cella di destinazione
+ ///
+ public bool finRxRiprendiInCaricoUDC(string UDC, string CodSoggetto, string tempAL, int idxCella)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcFinRxRicarica(UDC, idxCella, tempAL, DateTime.Now, CodSoggetto)[0];
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Sistema il cartellino Gitterbox Rx Finiti (B48) per la stampa
+ ///
+ /// Cod UDC da processare
+ /// Cod Imballo
+ /// Note x cartellino
+ /// Cod soggetto
+ ///
+ public bool Udc_B48_FullUpdate(string UDC, string CodImb, string Note, string CodSoggetto)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcRxFinLiqFullUpdate(UDC, CodImb, Note, DateTime.Now, CodSoggetto)[0];
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se l'UDC indicato sia valido, ovvero esistente
+ ///
+ ///
+ ///
+ public bool checkUDC(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (taCartellini.getDetailsUdcByUdc(UDC).Rows.Count > 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se l'UDC indicato sia ESENTE DA NC attive (ovvero senza deroga DC)
+ ///
+ ///
+ /// restituisce esito controllo
+ public checkUdcNc checkUDC_NC(string UDC)
+ {
+ /// default caso pessimo...
+ checkUdcNc answ = checkUdcNc.HasNc;
+ bool hasNc = false;
+ try
+ {
+ hasNc = (DataProxy.obj.taUDC2NC.getNcPending(UDC, "DC", "NC").Rows.Count != 0);
+ }
+ catch
+ { }
+ // se richiesto faccio verifica
+ if (memLayer.ML.CRB("checkUDC_NC"))
+ {
+ if (hasNc)
+ {
+ answ = checkUdcNc.HasNc;
+ }
+ else
+ {
+ answ = checkUdcNc.NoNc;
+ }
+ }
+ // altrimenti NON E' richiesta verifica
+ else
+ {
+ if (hasNc)
+ {
+ answ = checkUdcNc.ChkDis_HasNc;
+ }
+ else
+ {
+ answ = checkUdcNc.ChkDis_NoNc;
+ }
+ }
+ return answ;
+ }
+ ///
+ /// Fornisce elenco NC associate ad un UDC
+ ///
+ ///
+ ///
+ public DS_Applicazione.ElencoNCDataTable getNc2UDC(string UDC)
+ {
+ DS_Applicazione.ElencoNCDataTable answ = new DS_Applicazione.ElencoNCDataTable();
+ // controllo se ci siano NC
+ checkUdcNc esito = checkUDC_NC(UDC);
+ // se ci sono recupero!
+ if (esito == checkUdcNc.HasNc || esito == checkUdcNc.ChkDis_HasNc)
+ {
+ answ = DataProxy.obj.taENC.getByUDC(UDC);
+ }
+ return answ;
+ }
+ ///
+ /// Restituisce stringa formattata dellal NC associata all'UDC
+ ///
+ ///
+ ///
+ public string getDescrNc2Udc(string UDC)
+ {
+ DS_Applicazione.ElencoNCDataTable tab = getNc2UDC(UDC);
+ string answ = "";
+ if (tab.Rows.Count > 0)
+ {
+ DS_Applicazione.ElencoNCRow riga = null;
+ // recupero righe...
+ for (int i = 0; i < tab.Rows.Count; i++)
+ {
+ riga = (DS_Applicazione.ElencoNCRow)tab.Rows[i];
+ answ += string.Format("NC: {0}, {1}
", riga.CodNC, riga.DescrNC);
+ //answ += string.Format("NC: {0}, {1}
{2} | {3} | {4} ({5:yyyy.MM.dd HH:mm} --> {6:yyyy.MM.dd HH:mm})
", riga.CodNC, riga.DescrNC, riga.TipoCart, riga.Particolare, riga.SearchNote, riga.DataFrom, riga.DataTo);
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// verifica se l'UDC indicato POSSA ESSERE MOVIMENTATO (ovvero NON in LDP in stato "bloccato")
+ ///
+ ///
+ ///
+ public bool checkUDC_mov(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (taRigheListePrelievo.getBloccateMovByUdc(UDC).Rows.Count == 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se l'UDC indicato POSSA ESSERE OGGETTO DI RETTIFICA QTA (ovvero NON in LDP in stato "bloccato")
+ ///
+ ///
+ ///
+ public bool checkUDC_qty(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (taRigheListePrelievo.getBloccateQtaByUdc(UDC).Rows.Count == 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// effettua lo scaricamento (da db e da AS400) degli UDC di MP/WIP, registrando l'evento "UDC_CONS"
+ ///
+ /// Codice UDC
+ /// IP del chiamante
+ ///
+ public bool scaricaUdcMpWip(string UDC, string clientIp)
+ {
+ // inizializzo
+ bool answ = false;
+ int idxCellaFrom = 0;
+ int idxPosizUdcCorr = 0;
+ int idxPosizUdcDest = 0;
+ string CodEvento = "UDC_CONS";
+ // calcolo posizione UDC corrente (se c'è...)
+ try
+ {
+ // mi serve per posizione udc corrente
+ DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
+ // il secondo idx che mi serve
+ idxCellaFrom = rigaUdcCorrente.IdxCella;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di recupero cella per l'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
+ }
+ // ora calcolo gli altri dati dalla riga ElencoCartellini dell'UDC
+ try
+ {
+ // calcolo posizione destinazione da state machine...
+ idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(CodEvento, idxPosizUdcCorr);
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di recupero dati posizioni from/to per l'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
+ }
+ // ora provo ad eseguire!
+ try
+ {
+ if (idxPosizUdcDest != 0) // solo se c'è una posizione da cui poter fare lo scaricamento...
+ {
+ // sposto UDC
+ answ = scaricaUDC(UDC, idxPosizUdcDest, CodEvento, clientIp);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di scaricamento dell'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
+ }
+
+ return answ;
+ }
+ ///
+ /// riattiva un UDC (se permesso) da una posizione consumata ad una valida
+ ///
+ /// Codice UDC
+ /// Cod soggetto utente
+ /// IP del chiamante
+ ///
+ public bool riattivaUdc(string UDC, string CodSoggetto, string clientIp)
+ {
+ // init
+ bool answ = false;
+ try
+ {
+ // salvo dati cartellino PRE
+ DS_Applicazione.ElencoCartelliniRow rigaUdcPre = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0];
+ GMW_data.DataProxy.obj.taCartellini.stp_riattivaUdc(UDC, CodSoggetto);
+ logger.lg.scriviLog(string.Format(" | {0} | riattivato UDC {1} | soggetto {2}", clientIp, UDC, CodSoggetto), tipoLog.INFO);
+ // salvo dati cartellino POST
+ DS_Applicazione.ElencoCartelliniRow rigaUdcPost = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0];
+ answ = true;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {2} | Eccezione: {0}{1}", Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
+ }
+
+ return answ;
+ }
+ ///
+ /// sblocca un UDC (se permesso)
+ ///
+ /// Codice UDC
+ /// Cod soggetto utente
+ /// IP del chiamante
+ ///
+ public bool sbloccaUdc(string UDC, string CodSoggetto, string clientIp)
+ {
+ // init
+ bool answ = false;
+ try
+ {
+ GMW_data.DataProxy.obj.taCartellini.stp_sbloccaUdc(UDC, CodSoggetto);
+ logger.lg.scriviLog(string.Format(" | {0} | sbloccato UDC {1} | soggetto {2}", clientIp, UDC, CodSoggetto), tipoLog.INFO);
+ answ = true;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {2} | Eccezione: {0}{1}", Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ ///
+ /// controlla se l'udc della qualità indicato ha benestare qualità ("S")
+ ///
+ ///
+ ///
+ public bool udcMpHasBenesQual(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.RapQualRow rigaRapQual = taRapQual.getByUdc(UDC)[0];
+ if (rigaRapQual.BenesQual == "S")
+ {
+ answ = true;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// controlla se l'udc indicato è già stato consumato
+ ///
+ ///
+ ///
+ public bool udcMpIsConsumabile(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.ElencoCartelliniRow rigaUDC = taCartellini.getByUdc(UDC)[0];
+ if (rigaUDC.IdxPosizione > 0)
+ {
+ answ = true;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce IdxPosizione dell'UDC
+ ///
+ ///
+ ///
+ public int IdxPosizioneUdc(string UDC)
+ {
+ int answ = 0;
+ try
+ {
+ answ = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce il CodStato dell'UDC
+ ///
+ ///
+ ///
+ public string CodStatoUdc(string UDC)
+ {
+ string answ = "";
+ try
+ {
+ answ = taCartellini.getDetailsUdcByUdc(UDC)[0].CodStato;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce cella in cui si trova l'UDC
+ ///
+ ///
+ ///
+ public string codCellaUdc(string UDC)
+ {
+ string answ = "";
+ try
+ {
+ int idxCella = taPosUdcCorr.getByUDC(UDC)[0].IdxCella;
+ answ = taCelle.getByIdxCella(idxCella)[0].CodCella;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce codBlocco in cui si trova l'UDC
+ ///
+ ///
+ ///
+ public string codBloccoUdc(string UDC)
+ {
+ string answ = "";
+ try
+ {
+ int idxCella = taPosUdcCorr.getByUDC(UDC)[0].IdxCella;
+ int idxBlocco = taCelle.getByIdxCella(idxCella)[0].IdxBlocco;
+ answ = taBlocchi.getByIdx(idxBlocco)[0].CodBlocco;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ ///
+ /// verifica se UDC sia ok x LDP secondo stored stp_getUdcDetailOkLP (LPA/LPX)
+ ///
+ ///
+ ///
+ public bool checkUdc_OkLPAX(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ answ = taDettUDC.getByUdcOkLp(UDC).Rows.Count > 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// controlla se l'udc indicato sia in una LDP
+ ///
+ ///
+ ///
+ public bool udcInLdp(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ DS_magazzino.RigheListePrelievoDataTable tabRLDP = taRigheListePrelievo.getByUdc(UDC);
+ if (tabRLDP.Rows.Count > 0)
+ {
+ answ = true;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce il codice UDC calcolato
+ ///
+ ///
+ ///
+ /// 2 cifre
+ ///
+ ///
+ public string getComposizioneUDC(string CodCS, string flusso, string anno, int numUDC)
+ {
+ string answ = "";
+ try
+ {
+ answ = string.Format("U{0}{1}{2}{3}", CodCS, flusso, anno, numUDC.ToString().PadLeft(6, '0'));
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// fornisce il codice trattamento calcolato
+ ///
+ /// se > 2 cifre trim e tiene ultime 2..
+ /// Numero trattamento
+ ///
+ public string getCompTrattamenti(string anno, string numTr)
+ {
+ string answ = "";
+ try
+ {
+ answ = string.Format("{0}{1}", anno.Substring(anno.Length - 2, 2), numTr.PadLeft(6, '0'));
+ }
+ catch
+ { }
+ return answ;
+ }///
+ /// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e associa ad AL e mette nella cella richiesta
+ ///
+ /// AL da associare
+ /// AL Sorgente (da disattivare)
+ /// DataMatrix da spostare
+ ///
+ /// codice cella destinazione
+ /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa)
+ /// codice anagrafico del cliente
+ /// codice del particolare (articolo) - da anagrafica!
+ /// Codice dell'impianto
+ /// Codice dello stampo
+ /// codice dell'esponente dello stampo
+ /// Codice figura
+ /// codice dell'UDC parent (UDC della tara)
+ /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore
+ /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)
+ /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)
+ /// codice dell'operatore
+ /// numero pezzi associati all'UDC
+ /// Peso totale rilevato
+ /// Peso unitario rilevato
+ /// Data di rif per la dichiarazione
+ /// Turno di rif per la dichiarazione
+ /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...)
+ /// Codice del magazzino in cui inserire l'UDC
+ /// NOME della posizione default in cui creare UDC
+ /// cod evento da associare al movimento mag
+ /// note (opzionali)
+ /// cod UDC pre-calcolato, se "" verrà calcolato dalla query
+ /// anno in cui intestare i cartellini, trimma a 2 cifre DX
+ /// Ip del client
+ /// UDC del nuovo cartellino per FINITI
+ public string creaUdcWithAlCella(string AL, string SourceAL, string DataMatrix, string CodStatoUdcOut, string CodCella, string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, string defIdxPosiz, string codEvento, string note, string UDC, int anno, string clientIp)
+ {
+ // trim fix
+ string CodBilanciaTrim = CodBilancia.Trim();
+ string CodClienteTrim = CodCliente.Trim();
+ string ParticolareTrim = Particolare.Trim();
+ string CodImpiantoTrim = CodImpianto.Trim();
+ string CodStampoTrim = CodStampo.Trim();
+ string EsponenteTrim = Esponente.Trim();
+ string FiguraTrim = Figura.Trim();
+ string UDC_parentTrim = UDC_parent.Trim();
+ string CodImballoTrim = CodImballo.Trim();
+ string CodTipoDichiarazioneTrim = CodTipoDichiarazione.Trim();
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ string CodStatoTrim = CodStato.Trim();
+ string defIdxPosizTrim = defIdxPosiz.Trim();
+ string codEventoTrim = codEvento.Trim();
+ string noteTrim = note.Trim();
+ string annoTrim = anno.ToString();
+ if (annoTrim.Length > 2)
+ {
+ annoTrim = annoTrim.Substring(2, 2);
+ }
+ // determino se cancellare udcTara
+ bool doDeleteUdcTara = false; // memLayer.ML.confReadBool("doDeleteUdcTara");
+ // ricavo cod company...
+ string CodCS = "ND";
+ string answ = "NA";
+ try
+ {
+ CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilanciaTrim)[0].CodCS;
+ }
+ catch
+ {
+ CodCS = memLayer.ML.cdv("CodCS");
+ }
+ int IdxPosizione = 0;
+ if (CodMag > 0)
+ {
+ IdxPosizione = CodMag;
+ }
+ else
+ {
+ IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
+ }
+ // controllo di avere codice soggetto e particolare validi (!="")
+ if (ParticolareTrim != "" && CodSoggettoTrim != "")
+ {
+ // creo nuovo cartellino!
+ DS_Applicazione.ElencoCartelliniDataTable tabUdc = new DS_Applicazione.ElencoCartelliniDataTable();
+ // insert nuovo UDC con codice impostato
+ try
+ {
+ tabUdc = DataProxy.obj.taCartellini.stp_insNewFullWithAL(AL, SourceAL, DataMatrix, CodStatoUdcOut, CodCella, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
+ answ = UDC;
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull_fixUDC, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23} | {24}{25}{26}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp, Environment.NewLine, exc), tipoLog.INFO);
+ }
+ // leggo la riga
+ answ = tabUdc[0].UDC;
+ // loggo tutto!
+ if (memLayer.ML.confReadInt("_logLevel") > 5)
+ {
+ try
+ {
+ logger.lg.scriviLog(string.Format(" | {24} | NUOVO cartellino da postazione: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
+ }
+ catch
+ { }
+ }
+ // solo se UDC parent != vuoto...
+ if (UDC_parentTrim != "")
+ {
+ try
+ {
+ // salvo associazione parent-child tra UDC!
+ DataProxy.obj.taRelazUDC.Insert(UDC_parentTrim, answ, DateTime.Now);
+ }
+ catch
+ { }
+ }
+ }
+ return answ;
+ }
+ ///
+ /// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati
+ ///
+ /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa)
+ /// codice anagrafico del cliente
+ /// codice del particolare (articolo) - da anagrafica!
+ /// Codice dell'impianto
+ /// Codice dello stampo
+ /// codice dell'esponente dello stampo
+ /// Codice figura
+ /// codice dell'UDC parent (UDC della tara)
+ /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore
+ /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)
+ /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)
+ /// codice dell'operatore
+ /// numero pezzi associati all'UDC
+ /// Peso totale rilevato
+ /// Peso unitario rilevato
+ /// Data di rif per la dichiarazione
+ /// Turno di rif per la dichiarazione
+ /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...)
+ /// Codice del magazzino in cui inserire l'UDC
+ /// NOME della posizione default in cui creare UDC
+ /// cod evento da associare al movimento mag
+ /// note (opzionali)
+ /// cod UDC pre-calcolato, se "" verrà calcolato dalla query
+ /// anno in cui intestare i cartellini, trimma a 2 cifre DX
+ /// Ip del client
+ /// UDC del nuovo cartellino per FINITI
+ public string creaUdc(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, string defIdxPosiz, string codEvento, string note, string UDC, int anno, string clientIp)
+ {
+ // trim fix
+ string CodBilanciaTrim = CodBilancia.Trim();
+ string CodClienteTrim = CodCliente.Trim();
+ string ParticolareTrim = Particolare.Trim();
+ string CodImpiantoTrim = CodImpianto.Trim();
+ string CodStampoTrim = CodStampo.Trim();
+ string EsponenteTrim = Esponente.Trim();
+ string FiguraTrim = Figura.Trim();
+ string UDC_parentTrim = UDC_parent.Trim();
+ string CodImballoTrim = CodImballo.Trim();
+ string CodTipoDichiarazioneTrim = CodTipoDichiarazione.Trim();
+ string CodSoggettoTrim = CodSoggetto.Trim();
+ string CodStatoTrim = CodStato.Trim();
+ string defIdxPosizTrim = defIdxPosiz.Trim();
+ string codEventoTrim = codEvento.Trim();
+ string noteTrim = note.Trim();
+ string annoTrim = anno.ToString();
+ if (annoTrim.Length > 2)
+ {
+ annoTrim = annoTrim.Substring(2, 2);
+ }
+ // determino se cancellare udcTara
+ bool doDeleteUdcTara = false; // memLayer.ML.confReadBool("doDeleteUdcTara");
+ // ricavo cod company...
+ string CodCS = "ND";
+ string answ = "NA";
+ try
+ {
+ CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilanciaTrim)[0].CodCS;
+ }
+ catch
+ {
+ CodCS = memLayer.ML.cdv("CodCS");
+ }
+ int IdxPosizione = 0;
+ if (CodMag > 0)
+ {
+ IdxPosizione = CodMag;
+ }
+ else
+ {
+ IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
+ }
+ //int IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
+ // controllo di avere codice soggetto e particolare validi (!="")
+ if (ParticolareTrim != "" && CodSoggettoTrim != "")
+ {
+ // creo nuovo cartellino!
+ DS_Applicazione.ElencoCartelliniDataTable tabUdc = new DS_Applicazione.ElencoCartelliniDataTable();
+ // controllo se UDC già definito o meno...
+ if (UDC != "")
+ {
+ // insert nuovo UDC con codice impostato
+ try
+ {
+ tabUdc = DataProxy.obj.taCartellini.stp_insNewFull_fixUDC(UDC, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
+ answ = UDC;
+ }
+ catch
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull_fixUDC, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
+ }
+ }
+ else
+ {
+ // insert con calcolo UDC
+ try
+ {
+ tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
+ }
+ catch (Exception exc)
+ {
+ // loggo errore
+ logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}{25}{26}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp, Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ }
+ // leggo la riga
+ answ = tabUdc[0].UDC;
+ // loggo tutto!
+ if (memLayer.ML.confReadInt("_logLevel") > 5)
+ {
+ try
+ {
+ logger.lg.scriviLog(string.Format(" | {24} | NUOVO cartellino da postazione: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
+ }
+ catch
+ { }
+ }
+ // solo se UDC parent != vuoto...
+ if (UDC_parentTrim != "")
+ {
+ try
+ {
+ // salvo associazione parent-child tra UDC!
+ DataProxy.obj.taRelazUDC.Insert(UDC_parentTrim, answ, DateTime.Now);
+ }
+ catch
+ { }
+ }
+ }
+ else
+ {
+ logger.lg.scriviLog(string.Format(" | {24} | CodSoggetto / particolare non validi! tentativo di creazione cartellino come {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22}", CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.ERROR);
+ }
+ return answ;
+ }
+ ///
+ /// associa udc all'UDCParent
+ ///
+ /// UDC destinazione
+ /// UDC parent
+ ///
+ public bool associaUdcParent(string codUdc, string codParent)
+ {
+ bool answ = false;
+ try
+ {
+ answ = associaUdcParent(codUdc, codParent, false);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// VERIFICA se ci sia associazione tra udc e l'UDCParent e restituisce TRUE se sia già associato
+ ///
+ /// UDC destinazione
+ /// UDC parent
+ ///
+ public bool checkAssociazioneUdcParent(string codUdc, string codParent)
+ {
+ bool answ = false;
+ try
+ {
+ answ = DataProxy.obj.taRelazUDC.getByParentChild(codUdc, codParent).Rows.Count > 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// calcola l'UDC Parent di quello fornito
+ ///
+ /// UDC destinazione
+ /// UDC parent
+ ///
+ public string getUdcParent(string codUdc)
+ {
+ string answ = "";
+ try
+ {
+ answ = ((DS_Applicazione.RelazUDCRow)DataProxy.obj.taRelazUDC.stp_getParent(codUdc)[0]).UDC_parent;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// calcola l'UDC Parent di quello fornito IN ORDINE DESCENDING
+ ///
+ /// UDC destinazione
+ /// UDC parent
+ ///
+ public string getUdcParentDesc(string codUdc)
+ {
+ string answ = "";
+ try
+ {
+ answ = ((DS_Applicazione.RelazUDCRow)DataProxy.obj.taRelazUDC.stp_getParentDesc(codUdc)[0]).UDC_parent;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// associa udc all'UDCParent
+ ///
+ /// UDC destinazione
+ /// UDC parent
+ /// copiare si/no attributi UDC da parent a child
+ ///
+ public bool associaUdcParent(string codUdc, string codParent, bool copyAttr)
+ {
+ bool answ = false;
+ try
+ {
+ DataProxy.obj.taCartellini.stp_UDC_associaParent(codUdc, codParent, CodSoggCurrUser, copyAttr);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// effettua la stampa di un dato UDC
+ ///
+ /// Codice UDC
+ /// stampante specifica (da postazioen o std da webconfig, a cura dell'utente
+ /// IP del chiamante
+ ///
+ public bool stampaUdc(string UDC, string printer, tipoCartellino tipoCart, string clientIp)
+ {
+ bool answ = false;
+ // controllo se esista UDC
+ if (checkUDC(UDC))
+ {
+ answ = reportPrinter.obj.stampaCartellino(tipoCart, UDC, printer);
+ logger.lg.scriviLog(string.Format(" | {0} | stampato UDC {1} | stampante {2} | tipo {3}", clientIp, UDC, printer, tipoCart), tipoLog.INFO);
+ }
+ return answ;
+ }
+
+ ///
+ /// effettua la Ristampa di un dato UDC partendo dal primo tipo di cartellino stampato...
+ ///
+ /// Codice UDC
+ /// stampante specifica (da postazioen o std da webconfig, a cura dell'utente
+ /// IP del chiamante
+ ///
+ public bool ristampaUdc(string UDC, string printer, string clientIp)
+ {
+ bool answ = false;
+ tipoCartellino tipoCart = tipoCartellino.cartND;
+ try
+ {
+ tipoCart = (tipoCartellino)Enum.Parse(typeof(tipoCartellino), DataProxy.obj.taPJQ.getFirstByUdc(UDC)[0].TipoCart);
+ }
+ catch
+ { }
+ if (tipoCart != tipoCartellino.cartND)
+ {
+ // controllo se esista UDC
+ if (checkUDC(UDC))
+ {
+ answ = reportPrinter.obj.stampaCartellino(tipoCart, UDC, printer);
+ logger.lg.scriviLog(string.Format(" | {0} | stampato UDC {1} | stampante {2} | tipo {3}", clientIp, UDC, printer, tipoCart), tipoLog.INFO);
+ }
+ }
+ return answ;
+ }
+ ///
+ /// restituisce particolare da UDC
+ ///
+ ///
+ ///
+ public string getParticolareByUDC(string UDC)
+ {
+ string answ = "";
+ try
+ {
+ answ = (taCartellini.getDetailsUdcByUdc(UDC)[0].Particolare);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce note dell'UDC
+ ///
+ ///
+ ///
+ public string getNoteByUDC(string UDC)
+ {
+ string answ = "";
+ try
+ {
+ answ = (taCartellini.getDetailsUdcByUdc(UDC)[0].Note);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// aggiorna note dell'UDC
+ ///
+ ///
+ ///
+ public void updateNoteUDC(string UDC, string note)
+ {
+ taCartellini.updateNote(UDC, note, CodSoggCurrUser);
+ }
+ ///
+ /// aggiorna posizione dell'UDC
+ ///
+ ///
+ ///
+ public void updatePosizioneUDC(string UDC, int idxPosizione)
+ {
+ taCartellini.updateIdxPosizione(UDC, idxPosizione, CodSoggCurrUser);
+ }
+ ///
+ /// aggiorna note e posizione dell'UDC
+ ///
+ ///
+ ///
+ ///
+ public void updateNotePosizioneUDC(string UDC, string note, int idxPosizione)
+ {
+ taCartellini.updateNotePosizione(UDC, idxPosizione, note, CodSoggCurrUser);
+ }
+ ///
+ /// aggiorna note, posizione e data fusione dell'UDC
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void updateNotePosizioneDataUDC(string UDC, string note, int idxPosizione, DateTime DataFus)
+ {
+ taCartellini.updateNotePosizioneData(UDC, idxPosizione, note, CodSoggCurrUser, DataFus);
+ }
+ ///
+ /// aggiorna note, posizione e data fusione dell'UDC
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void updateNotePosizioneDataImballoUDC(string UDC, string note, int idxPosizione, DateTime DataFus, string CodImballo)
+ {
+ taCartellini.updateNotePosizioneDataImballo(UDC, idxPosizione, note, CodSoggCurrUser, DataFus, CodImballo);
+ }
+ ///
+ /// aggiorna note, posizione e data fusione dell'UDC
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void updateFinDtxFull(string UDC, string note, DateTime DataFus, string CodImballo, string AL)
+ {
+ taCartellini.finDatamatrixFullUpdate(AL, UDC, CodImballo, note, DataFus, CodSoggCurrUser);
+ }
+ ///
+ /// Verifica se UDC abbia attributo indicato
+ ///
+ ///
+ ///
+ ///
+ public bool udcHasAttr(string UDC, string CodAttr)
+ {
+ bool answ = false;
+ try
+ {
+ answ = MagClass.magazzino.taAtt2UDC.getByUdc(UDC).Select(string.Format("CodAttr = '{0}'", CodAttr)).Length > 0 ? true : false;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ #endregion
+
+ #region procedure di verifica e traduzione dati da anagrafiche
+
+ ///
+ /// Verifica la corrispondenza dati tra RigheListePrelievo ed ElencoCartellini
+ ///
+ ///
+ ///
+ ///
+ public bool verificaDatiUdc(string CodLista, string UDC)
+ {
+ bool answ = false;
+
+ try
+ {
+ DS_magazzino.ElencoListePrelievoDataTable tabellaElenco = taElencoListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.ElencoListePrelievoRow rigaElenco = tabellaElenco[0];
+
+ DS_magazzino.ElencoCartelliniDataTable tabellaUDC = taCartellini.getDetailsUdcByUdc(UDC);
+ DS_magazzino.ElencoCartelliniRow rigaUDC = tabellaUDC[0];
+
+ // ricavo dati da confrontare - da Lista ricavo particolare/esponente/figura
+ string particolareLista = rigaElenco.Particolare.Trim();
+ string esponenteLista = rigaElenco.Esponente.Trim();
+ string figuraLista = rigaElenco.Figura.Trim();
+ string CodImballoLista = rigaElenco.CodImballo.Trim();
+
+ //stessi dati da UDC
+ string particolareUDC = rigaUDC.Particolare.Trim();
+ string esponenteUDC = rigaUDC.Esponente.Trim();
+ string figuraUDC = rigaUDC.Figura.Trim();
+ string CodImballoUDC = rigaUDC.CodImballo.Trim();
+
+ // condizioni di uguaglianza...
+ bool particolareOk = false;
+ bool esponenteOk = false;
+ bool figuraOk = false;
+ bool CodImballoOk = false;
+ // verifico le condizioni 1 ad 1...
+ particolareOk = (particolareLista == particolareUDC);
+ if (esponenteLista == "*")
+ {
+ esponenteOk = true;
+ }
+ else
+ {
+ esponenteOk = (esponenteLista == esponenteUDC);
+ }
+ if (figuraLista == "*")
+ {
+ figuraOk = true;
+ }
+ else
+ {
+ figuraOk = (figuraLista == figuraUDC);
+ }
+ if (CodImballoLista == "*")
+ {
+ CodImballoOk = true;
+ }
+ else
+ {
+ CodImballoOk = (CodImballoLista == CodImballoUDC);
}
- #endregion
+ // verifica finale del risultato uguaglianza...
+ answ = (particolareOk && esponenteOk && figuraOk && CodImballoOk);
+ }
+ catch
+ {
+ answ = false;
+ }
- #region operazioni su UDC
+ return answ;
+ }
+ ///
+ /// restituisce codice soggetto dell'user corrente
+ ///
+ ///
+ public string CodSoggCurrUser
+ {
+ get
+ {
+ // ricavo da session...
+ string CodSoggetto = "";
+ try
+ {
+ CodSoggetto = memLayer.ML.StringSessionObj("CodSoggetto");
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format("Non sono riuscito a recuperare il codice soggetto DALLA SESSIONE per l'utente loggato: {0}, errore {1}{2}", user_std.UtSn.userNameAD, Environment.NewLine, e), tipoLog.ERROR);
+ }
+ if (CodSoggetto == "")
+ {
+ // provo a recuperare da cookie...
+ CodSoggetto = memLayer.ML.getCookieVal("CodSoggetto");
+ }
+ if (CodSoggetto == "")
+ {
+ try
+ {
+ CodSoggetto = DataProxy.obj.taSogg2Oper.getByUserDominio(user_std.UtSn.utente, user_std.UtSn.dominio)[0].CodSoggetto;
+ // salvo in sessione...
+ memLayer.ML.setSessionVal("CodSoggetto", CodSoggetto);
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format("Non sono riuscito a recuperare il codice soggetto per l'utente loggato: {0}, errore {1}{2}", user_std.UtSn.userNameAD, Environment.NewLine, e), tipoLog.ERROR);
+ }
+ }
+ return CodSoggetto;
+ }
+ }
+ ///
+ /// restituisce l'IdxCella dato il CodCella
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public int IdxCellaByCodCella(string CodCS, string CodCella)
+ {
+ int answ = 0;
+ try
+ {
+ answ = taCelle.getByCodCella(CodCella)[0].IdxCella; // NON controllo il CodCS...
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce il CodCella dato l'IdxCella
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public string CodCellaByIdxCella(string CodCS, int IdxCella)
+ {
+ string answ = "";
+ try
+ {
+ answ = taCelle.getByIdxCella(IdxCella)[0].CodCella; // NON controllo il CodCS...
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se la cella indicata sia attiva
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public bool cellaAttiva(string CodCS, int IdxCella)
+ {
+ bool answ = false;
+ try
+ {
+ answ = taCelle.getByIdxCella(IdxCella)[0].Attiva; // NON controllo il CodCS...
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se la cella indicata sia piena
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public bool cellaPiena(string CodCS, int IdxCella)
+ {
+ bool answ = false; //default non piena = permette caricamento
+ int idxTipoCella = 0;
+ bool checkPiena = true;
+ try
+ {
+ // controllo il tipo cella, se richiede check piena (altrimenti do ok...)
+ idxTipoCella = taCelle.getByIdxCella(IdxCella)[0].IdxTipoCella;
+ checkPiena = taTipoCella.getByIdx(idxTipoCella)[0].CheckPiena;
+ }
+ catch
+ { }
+ if (checkPiena)
+ {
+ try
+ {
+ // faccio controllo effettivo cella piena
+ answ = taCelle.getByIdxCella(IdxCella)[0].Piena; // NON controllo il CodCS...
+ }
+ catch
+ { }
+ }
+ return answ;
+ }
+ ///
+ /// restituisce cod UDC associato ad una cella
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public string udcInCella(string CodCS, int IdxCella)
+ {
+ string answ = "";
+ try
+ {
+ answ = taPosUdcCorr.getByIdxCella(IdxCella)[0].UDC;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica la cella indicata sia valida, ovvero esistente
+ ///
+ ///
+ ///
+ public bool checkCella(string CodCella)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (taCelle.getByCodCella(CodCella).Rows.Count > 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se il particolare indicato sia valido, ovvero esistente
+ ///
+ /// Codice company/sito
+ ///
+ ///
+ public bool checkParticolare(string CodCS, string Particolare)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (utils.obj.taSelParticolari.getByConditioValue(Particolare, "*").Rows.Count > 0);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in check particolare:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ ///
+ /// restituisce il num di UDC che corrispondono alla richiesta indicata
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int numUdcDaPart(string CodCS, string Particolare, string codEsponente, string codFigura, string CodImballo, string codTipoLista)
+ {
+ int answ = 0;
+ try
+ {
+ answ = taVParticolariOverwiew.getByDatiListaPrelievo(Particolare, CodCS, codEsponente, codFigura, CodImballo, codTipoLista)[0].NumUDC;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// verifica se l'UDC sia riattivabile, ovvero
+ /// - sia permesso da web.config
+ /// - l'UDC sia in un mag che permette riattivazione
+ ///
+ ///
+ ///
+ public bool udcIsRiattivabile(string UDC)
+ {
+ bool answ = false;
+ // se permesso da web config controllo
+ if (memLayer.ML.confReadBool("riattUdcPermessa"))
+ {
+ try
+ {
+ // recupero posizione attuale
+ int IdxPosizione = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ // verifico se riattivabile
+ answ = taAnagPos.getByIdxPosizione(IdxPosizione)[0].IsRiattivaEnabled;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format("Errore nella riattivazione dell'UDC {0}:{1}{2}", UDC, Environment.NewLine, e), tipoLog.EXCEPTION);
+ }
+ }
+ return answ;
+ }
- ///
- /// effettua lo spostamento di un UDC tra 2 posizioni indicate
- ///
- /// Codice company/sito
- /// Codice UDC
- /// Cella di destinazione
- /// indica se sia richiesto resettare le Righe Liste Prelievo con lo spostsamento
- /// IP del chiamante
- /// esito comando
- public bool spostaUDC(string CodCS, string UDC, int IdxCellaTo, bool resetRLP, string clientIp)
- {
- bool answ = false;
- // procedo SOLO se la cella di dest è VUOTA...
- if (!MagClass.magazzino.cellaPiena(CodCS, IdxCellaTo))
- {
- try
- {
- taPosUdcCorr.stp_spostaUdc(CodCS, UDC, IdxCellaTo, resetRLP, CodSoggCurrUser);
- // cerco nuova posizione...
- if (taPosUdcCorr.getByCellaUdc(UDC, IdxCellaTo).Rows.Count > 0)
- {
- answ = true;
- }
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {1} | Errore durante spostamento cella: {0}", e, clientIp), tipoLog.EXCEPTION);
- }
- // solo se ha fatto spostamento posizione corrente verifico se fare spostamento in posizione LOGICA magazzino
- if (answ)
- {
- try
- {
- // verifico tipo cella e se ci sia da fare spostamento in mag logico/contabile
- int idxTipoCella = taCelle.getByIdxCella(IdxCellaTo)[0].IdxTipoCella;
- bool needSetMag = taTipoCella.getByIdx(idxTipoCella)[0].SetMag;
- if (needSetMag)
- {
- // cambio (eventualmente) la posizione "logica" dato lo spostamento (il codice magazzino...)
- int idxBlocco = taCelle.getByIdxCella(IdxCellaTo)[0].IdxBlocco;
- int IdxPosizione = Convert.ToInt32(taBlocchi.getByIdx(idxBlocco)[0].CodMag);
- taCartellini.updateIdxPosizione(UDC, IdxPosizione, CodSoggCurrUser);
- }
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {1} | Errore durante indicazione posizione UDC: {0}", e, clientIp), tipoLog.EXCEPTION);
- }
- }
- }
- else
- {
- logger.lg.scriviLog(string.Format(" | {1} | Errore, cella {0} di destinazione piena!!!", IdxCellaTo, clientIp), tipoLog.ERROR);
- }
- return answ;
- }
- ///
- /// effettua lo scaricamento di un UDC (x spedizione)
- ///
- /// Codice UDC
- /// Codice posizione UDC finale
- /// Codice evento associato allo scaricamento
- /// IP del chiamante
- /// esito comando
- public bool scaricaUDC(string UDC, int IdxPosizUdc, string CodEvento, string clientIp)
- {
- bool answ = false;
- try
- {
- taPosUdcCorr.stp_scaricaUdc(UDC, IdxPosizUdc, CodEvento, CodSoggCurrUser);
- logger.lg.scriviLog(string.Format(" | {0} | Scaricato UDC {1} | posizione {2} | CodEvento {3} | soggetto {4}", clientIp, UDC, IdxPosizUdc, CodEvento, CodSoggCurrUser), tipoLog.INFO);
- answ = true;
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format(" | {2} | Errore in scaricaUDC:{0}{1}", Environment.NewLine, exc, clientIp), tipoLog.EXCEPTION);
- }
- return answ;
- }
- ///
- /// rettifica la qta di un UDC
- ///
- /// Codice UDC
- /// Nuova quantita associata
- /// IP del chiamante
- /// esito comando
- public bool rettificaQtaUDC(string UDC, decimal qta, string clientIp)
- {
- bool answ = false;
- try
- {
- int fatti = 0;
- fatti = taCartellini.updateQty(UDC, CodSoggCurrUser, "U", "UDC_QTY", qta).Rows.Count;
- if (fatti > 0)
- {
- answ = true;
- logger.lg.scriviLog(string.Format(" | {0} | Rettifica qta UDC {1} | qta {2} | soggetto {3}", clientIp, UDC, qta, CodSoggCurrUser), tipoLog.INFO);
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// rettifica la qta di un UDC
- ///
- /// Codice UDC sorgente
- /// Codice UDC destinazione
- /// Quantita da travasare
- /// IP del chiamante
- /// esito comando
- public bool travasoQtaUDC(string UdcFrom, string UdcDest, decimal qta, string clientIp)
- {
- bool answ = false;
- try
- {
- taCartellini.travasoQty(UdcFrom, UdcDest, CodSoggCurrUser, "U", "UDC_TraQTY", qta);
- logger.lg.scriviLog(string.Format(" | {0} | travaso qta UDC: da {1} a {2} | qta {3} | soggetto {4}", clientIp, UdcFrom, UdcDest, qta, CodSoggCurrUser), tipoLog.INFO);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Sistema il cartellino finito liquidi per la stampa
- ///
- /// AL sorgente in postazione (ATL)
- /// Tipo cart da legare (TT)
- /// Cod UDC da processare
- /// Cod Imballo
- /// Note x cartellino
- /// Cod soggetto
- ///
- public bool liquidiFullUpdate(string SourceAL, string TipoAlAnc, string UDC, string CodImb, string Note, string CodSoggetto)
- {
- bool answ = false;
- try
- {
- DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcLiqFullUpdate(SourceAL, TipoAlAnc, UDC, CodImb, Note, DateTime.Now, CodSoggetto)[0];
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Riprende in carico alla postazione un cartellino liquidi FINITO valido
- ///
- /// Cod UDC da processare
- /// Cod soggetto
- /// AL (temporaneo) di destinazione
- /// Cod cella di destinazione
- ///
- public bool liquidiRiprendiInCaricoUDC(string UDC, string CodSoggetto, string tempAL, int idxCella)
- {
- bool answ = false;
- try
- {
- DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcLiqRicarica(UDC, idxCella, tempAL, DateTime.Now, CodSoggetto)[0];
- answ = true;
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION);
- }
- return answ;
- }
- ///
- /// Riprende in carico alla postazione un cartellino Finiti Rx valido
- ///
- /// Cod UDC da processare
- /// Cod soggetto
- /// AL (temporaneo) di destinazione
- /// Cod cella di destinazione
- ///
- public bool finRxRiprendiInCaricoUDC(string UDC, string CodSoggetto, string tempAL, int idxCella)
- {
- bool answ = false;
- try
- {
- DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcFinRxRicarica(UDC, idxCella, tempAL, DateTime.Now, CodSoggetto)[0];
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Sistema il cartellino Gitterbox Rx Finiti (B48) per la stampa
- ///
- /// Cod UDC da processare
- /// Cod Imballo
- /// Note x cartellino
- /// Cod soggetto
- ///
- public bool Udc_B48_FullUpdate(string UDC, string CodImb, string Note, string CodSoggetto)
- {
- bool answ = false;
- try
- {
- DS_magazzino.ElencoCartelliniRow riga = taCartellini.UdcRxFinLiqFullUpdate(UDC, CodImb, Note, DateTime.Now, CodSoggetto)[0];
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se l'UDC indicato sia valido, ovvero esistente
- ///
- ///
- ///
- public bool checkUDC(string UDC)
- {
- bool answ = false;
- try
- {
- answ = (taCartellini.getDetailsUdcByUdc(UDC).Rows.Count > 0);
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se l'UDC indicato sia ESENTE DA NC attive (ovvero senza deroga DC)
- ///
- ///
- /// restituisce esito controllo
- public checkUdcNc checkUDC_NC(string UDC)
- {
- /// default caso pessimo...
- checkUdcNc answ = checkUdcNc.HasNc;
- bool hasNc = false;
- try
- {
- hasNc = (DataProxy.obj.taUDC2NC.getNcPending(UDC, "DC", "NC").Rows.Count != 0);
- }
- catch
- { }
- // se richiesto faccio verifica
- if (memLayer.ML.CRB("checkUDC_NC"))
- {
- if (hasNc)
- {
- answ = checkUdcNc.HasNc;
- }
- else
- {
- answ = checkUdcNc.NoNc;
- }
- }
- // altrimenti NON E' richiesta verifica
- else
- {
- if (hasNc)
- {
- answ = checkUdcNc.ChkDis_HasNc;
- }
- else
- {
- answ = checkUdcNc.ChkDis_NoNc;
- }
- }
- return answ;
- }
- ///
- /// Fornisce elenco NC associate ad un UDC
- ///
- ///
- ///
- public DS_Applicazione.ElencoNCDataTable getNc2UDC(string UDC)
- {
- DS_Applicazione.ElencoNCDataTable answ = new DS_Applicazione.ElencoNCDataTable();
- // controllo se ci siano NC
- checkUdcNc esito = checkUDC_NC(UDC);
- // se ci sono recupero!
- if (esito == checkUdcNc.HasNc || esito == checkUdcNc.ChkDis_HasNc)
- {
- answ = DataProxy.obj.taENC.getByUDC(UDC);
- }
- return answ;
- }
- ///
- /// Restituisce stringa formattata dellal NC associata all'UDC
- ///
- ///
- ///
- public string getDescrNc2Udc(string UDC)
- {
- DS_Applicazione.ElencoNCDataTable tab = getNc2UDC(UDC);
- string answ = "";
- if (tab.Rows.Count > 0)
- {
- DS_Applicazione.ElencoNCRow riga = null;
- // recupero righe...
- for (int i = 0; i < tab.Rows.Count; i++)
- {
- riga = (DS_Applicazione.ElencoNCRow)tab.Rows[i];
- answ += string.Format("NC: {0}, {1}
", riga.CodNC, riga.DescrNC);
- //answ += string.Format("NC: {0}, {1}
{2} | {3} | {4} ({5:yyyy.MM.dd HH:mm} --> {6:yyyy.MM.dd HH:mm})
", riga.CodNC, riga.DescrNC, riga.TipoCart, riga.Particolare, riga.SearchNote, riga.DataFrom, riga.DataTo);
- }
- }
- return answ;
- }
+ #endregion
- ///
- /// verifica se l'UDC indicato POSSA ESSERE MOVIMENTATO (ovvero NON in LDP in stato "bloccato")
- ///
- ///
- ///
- public bool checkUDC_mov(string UDC)
+ #region liste di prelievo
+
+ ///
+ /// Crea una lista di prelievo andando a prenotare gli UDC del particolare richiesto in logica FIFO
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string creaListaPrelievo(string CodCS, string TipoListaPrelievo, string Particolare, string Esponente, string Figura, decimal QtaTot, string CodImballo, string Destinatario, string DestinatarioDescrizione)
+ {
+ /*
+ * - ordini gli UDC per data dal + vecchio (data fusione? direi di si!)
+ *
+ * - prenda 1 ad 1 gli UDC, e crei dall'UDC un record in RigheListePrelievo con
+ * - CodLista (dal record appena generato)
+ * - UDC (il + vecchio trovato)
+ * - QTA (dell'UDC)
+ * - Proposto = 1 (vero)
+ * - Prelevato = 0 (falso)
+ * - questo loop di prelievo va eseguito fino a quanto la somam delle qty sia maggiore o uguale alla qty richiesta, o fino a quando siano finiti gli UDC
+ *
+ * - potrebbe esser cambiato approccio e si potrebbe fare una query ceh seleziona i + vecchi UDC in numero corretto fin dall'inizio da includere facendo una cosa del tipo
+ * - calcolo media qty degli UDC papabili x le condizioni dette prima
+ * - dato il totale ottengo quanti UDC mi servono arrotondando x eccesso (se ho 200 richiesti, media 70, CEIL(200/70) = 3)
+ * - faccio un SELECT TOP n (qui 3) * FROM ElencoCartellini WHERE ...
+ * - e questa select la uso x farci un INSERT INTO in RigheListePrelievo
+ *
+ * - terminati questi step si aggiorna la lista di prelievo emttendo come qty quella data dalla somma degli UDC davvero proposti
+ *
+ * - la stored deve restituire il codice della lista di prelievo e passarla qui, che a sua volta passerà al chiamante il codice della lista
+ * */
+
+ string answ = "K";
+
+ // variabile di tipo datetime per data corrente
+ DateTime adesso = DateTime.Now;
+ // non la valorizzo qui ma calcolo ... se non fa verificare
+ string RagioneSociale = "";
+
+ // ricavo da session...
+ string CodSoggetto = CodSoggCurrUser;
+ // proseguo SOLO se ho trovato cod soggetto...
+ if (CodSoggetto != "")
+ {
+ // li ricavo da db successivamente
+ string DisegnoGrezzo = "";
+ string DescParticolare = "";
+ string codCliente = "";
+
+
+ // ricavo codCliente
+ try
{
- bool answ = false;
- try
- {
- answ = (taRigheListePrelievo.getBloccateMovByUdc(UDC).Rows.Count == 0);
- }
- catch
- { }
- return answ;
+ codCliente = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].CodCliente;
}
- ///
- /// verifica se l'UDC indicato POSSA ESSERE OGGETTO DI RETTIFICA QTA (ovvero NON in LDP in stato "bloccato")
- ///
- ///
- ///
- public bool checkUDC_qty(string UDC)
+ catch { }
+
+ // ricavo DisegnoGrezzo
+ try
{
- bool answ = false;
- try
- {
- answ = (taRigheListePrelievo.getBloccateQtaByUdc(UDC).Rows.Count == 0);
- }
- catch
- { }
- return answ;
+ DisegnoGrezzo = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DisegnoGrezzo;
}
- ///
- /// effettua lo scaricamento (da db e da AS400) degli UDC di MP/WIP, registrando l'evento "UDC_CONS"
- ///
- /// Codice UDC
- /// IP del chiamante
- ///
- public bool scaricaUdcMpWip(string UDC, string clientIp)
+ catch { }
+
+ try
{
- // inizializzo
- bool answ = false;
- int idxCellaFrom = 0;
+ DescParticolare = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DescParticolare;
+ }
+ catch { }
+
+ // dato codcliente ricavo la ragione sociale
+ try
+ {
+ RagioneSociale = DataProxy.obj.taAnagClienti.getRagioneSocialeByCodCliente(codCliente)[0].RagSociale;
+ }
+ catch { }
+
+
+ string codListaAttuale = "";
+ try
+ {
+ // eseguo soltanto la query (meglio con try catch così se non c'è non dà errore...)
+ DS_magazzino.ElencoListePrelievoDataTable tabellaElencoListe = taElencoListePrelievo.InsertQuery(string.Format("{0:yy}", adesso), string.Format("{0:MM}", adesso), TipoListaPrelievo, memLayer.ML.cdv("CodCS"), codCliente, RagioneSociale, CodSoggetto, Particolare, DescParticolare, DisegnoGrezzo, Esponente, Figura, CodImballo, QtaTot, Destinatario, DestinatarioDescrizione);
+
+ // ricavo prima (e unica) riga dalla select
+ DS_magazzino.ElencoListePrelievoRow rigaElencoListe = tabellaElencoListe[0];
+
+ // ricavo valore del CodLista attuale appena inserito
+ codListaAttuale = rigaElencoListe.CodLista;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format("Eccezione creazione lista prelievo: {0}{1}", Environment.NewLine, e), tipoLog.ERROR);
+ }
+ if (codListaAttuale != "")
+ {
+ answ = codListaAttuale;
+ DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = taCartellini.getUdcUnusedOlder(codListaAttuale);
+ allocaRigheListaPrelievo(QtaTot, codListaAttuale, tabellaElencoCartellini);
+ }
+ }
+ return answ;
+ }
+ ///
+ /// Crea una lista di prelievo andando a prenotare gli UDC del particolare richiesto in logica FIFO
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string creaListaPrelievoSmart(string CodCS, string TipoListaPrelievo, string Particolare, string Esponente, string Figura, decimal QtaTot, string CodImballo, string Destinatario, string DestinatarioDescrizione)
+ {
+ string answ = "K";
+
+ // variabile di tipo datetime per data corrente
+ DateTime adesso = DateTime.Now;
+ // non la valorizzo qui ma calcolo ... se non fa verificare
+ string RagioneSociale = "";
+
+ // ricavo da session...
+ string CodSoggetto = CodSoggCurrUser;
+ // proseguo SOLO se ho trovato cod soggetto...
+ if (CodSoggetto != "")
+ {
+ // li ricavo da db successivamente
+ string DisegnoGrezzo = "";
+ string DescParticolare = "";
+ string codCliente = "";
+
+
+ // ricavo codCliente
+ try
+ {
+ codCliente = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].CodCliente;
+ }
+ catch { }
+
+ // ricavo DisegnoGrezzo
+ try
+ {
+ DisegnoGrezzo = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DisegnoGrezzo;
+ }
+ catch { }
+
+ try
+ {
+ DescParticolare = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DescParticolare;
+ }
+ catch { }
+
+ // dato codcliente ricavo la ragione sociale
+ try
+ {
+ RagioneSociale = DataProxy.obj.taAnagClienti.getRagioneSocialeByCodCliente(codCliente)[0].RagSociale;
+ }
+ catch { }
+
+
+ string codListaAttuale = "";
+ try
+ {
+ // eseguo soltanto la query (meglio con try catch così se non c'è non dà errore...)
+ DS_magazzino.ElencoListePrelievoDataTable tabellaElencoListe = taElencoListePrelievo.InsertQuery(string.Format("{0:yy}", adesso), string.Format("{0:MM}", adesso), TipoListaPrelievo, memLayer.ML.cdv("CodCS"), codCliente, RagioneSociale, CodSoggetto, Particolare, DescParticolare, DisegnoGrezzo, Esponente, Figura, CodImballo, QtaTot, Destinatario, DestinatarioDescrizione);
+
+ // ricavo prima (e unica) riga dalla select
+ DS_magazzino.ElencoListePrelievoRow rigaElencoListe = tabellaElencoListe[0];
+
+ // ricavo valore del CodLista attuale appena inserito
+ codListaAttuale = rigaElencoListe.CodLista;
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format("Eccezione creazione lista prelievo: {0}{1}", Environment.NewLine, e), tipoLog.ERROR);
+ }
+ if (codListaAttuale != "")
+ {
+ answ = codListaAttuale;
+ }
+ }
+ return answ;
+ }
+ ///
+ /// indica come attivata in carico di una lista di prelievo
+ ///
+ /// Codice company/sito
+ /// codice della lista di prelievo
+ /// cod operatore carrellista
+ ///
+ public esitoOperazione attivaListaPrelievo(string CodCS, string CodLista, string CodSoggetto)
+ {
+ // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
+ esitoOperazione answ = esitoOperazione.errore;
+ try
+ {
+ // la query recupera la lista in base al CodLista
+ DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
+
+ // se la lista esiste...
+ if (tabella.Rows.Count > 0)
+ {
+ // se la lista è ancora non completata
+ if (riga.CodStatoLista == (int)statoLista.bozza)
+ {
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.generata);
+ answ = esitoOperazione.ok;
+ }
+ // se è solo iniziata permetto di riportarla a generata...
+ else if (riga.CodStatoLista == (int)statoLista.iniziata)
+ {
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.generata);
+ answ = esitoOperazione.ok;
+ }
+ // se è già completata dà errore
+ else
+ {
+ answ = esitoOperazione.errore_readOnly;
+ }
+ }
+ // se la lista non esiste dai errore
+ else
+ {
+ answ = esitoOperazione.errore;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// indica presa in carico di una lista di prelievo
+ ///
+ /// Codice company/sito
+ /// codice della lista di prelievo
+ /// cod operatore carrellista
+ ///
+ public esitoOperazione iniziaListaPrelievo(string CodCS, string CodLista, string CodSoggetto)
+ {
+ memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", CodLista));
+ memLayer.ML.setSessionVal("CodListaAttiva", CodLista, true);
+ // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
+ esitoOperazione answ = esitoOperazione.errore;
+
+ try
+ {
+ // la query recupera la lista in base al CodLista
+ DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
+
+ // se la lista esiste...
+ if (tabella.Rows.Count > 0)
+ {
+ // se la lista è ancora non completata
+ if (riga.CodStatoLista == (int)statoLista.generata)
+ {
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.iniziata);
+ answ = esitoOperazione.ok;
+ }
+ // se è già completata o iniziata dà errore
+ else
+ {
+ answ = esitoOperazione.errore_readOnly;
+ }
+ }
+ // se la lista non esiste dai errore
+ else
+ {
+ answ = esitoOperazione.errore;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// indica come completata (da parte del magazziniere) una lista di prelievo
+ ///
+ /// Codice company/sito
+ /// codice della lista di prelievo
+ /// cod operatore carrellista
+ /// IP del client
+ ///
+ public esitoOperazione completaListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp)
+ {
+ // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
+ esitoOperazione answ = esitoOperazione.errore;
+ try
+ {
+ // la query recupera la lista in base al CodLista
+ DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
+
+ // se la lista esiste...
+ if (tabella.Rows.Count > 0)
+ {
+ // se la lista è ancora non completata
+ if (riga.CodStatoLista == (int)statoLista.iniziata)
+ {
+ // controllo se ALMENO un UDC sia stsato prelevato
+ int numUdcPrelevati = taRigheListePrelievo.getByCodListaPrelevate(CodLista).Rows.Count;
+ if (numUdcPrelevati > 0)
+ {
+ // ricavo il codtipolista
+ string codTipoListaAttuale = riga.CodTipoLista;
+
+ //leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
+ DS_magazzino.TipoListaPrelievoDataTable tabellaTipoLista = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale);
+ DS_magazzino.TipoListaPrelievoRow rigaTipoLista = tabellaTipoLista[0];
+
+ // leggo da righe lista prelievo il dato udc che mi serve
+ DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
+ DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
+
+ // leggo il codice della cella...
+ string codCellaDestAttuale = rigaTipoLista.CodCella;
+ // lo trasformo x avere la cella di destinazione...
+ int idxCellaTo = taCelle.getByCodCella(codCellaDestAttuale)[0].IdxCella;
+ // sposto ("metto a terra") gli UDC
+ foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
+ {
+ // ricavo il codice UDC...
+ string _UDC = row.UDC;
+ // sposto UDC
+ spostaUDC(CodCS, _UDC, idxCellaTo, false, clientIp);
+ // dopo aver spostato UDC sistemo eventuali Righe di Prelievo x lo stesso UDC pending...
+ taRigheListePrelievo.stp_RLP_sbloccaNonPrelevate(CodLista, _UDC);
+ }
+ // libero le righe non prelevate...
+ taRigheListePrelievo.stp_RLP_eliminaNonPrelevate(CodLista);
+ // aggiorno stato lista
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.completata);
+ answ = esitoOperazione.ok;
+ memLayer.ML.emptySessionVal("CodListaAttiva");
+ memLayer.ML.emptySessionVal("activeTask");
+ }
+ else //nessun UDC prelevato
+ {
+ answ = esitoOperazione.errore_noUdc;
+ }
+ }
+ // se è già completata o NON iniziata dà errore
+ else
+ {
+ answ = esitoOperazione.errore_readOnly;
+ }
+ }
+ // se la lista non esiste dai errore
+ else
+ {
+ answ = esitoOperazione.errore;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Effettua lo scaricamento della lista di prelievo indicata, ovvero
+ /// - toglie dalle posizioni di magazzino tutti gli UDC indicati come prelevati (liberando tali posizioni)
+ /// - assegna tutti gli UDC prelevati alla cella indicata per il tipo di lista di prelievo interessata
+ /// - elimina eventuali righe di prelievo della lista per UDC non effettivamente prelevate
+ /// - chiude la lista di prelievo (completata = 1)
+ ///
+ /// Modifica vers 2.5: check trattamenti (ove attributo sia trovato...)
+ ///
+ /// Codice company/sito
+ /// codice della lista di prelievo
+ /// cod operatore carrellista
+ /// IP del client
+ /// Slot PL AS400 prescelto
+ /// esito comando
+ public esitoOperazione scaricaListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp, int SlotPL)
+ {
+ /*
+ * Questa funzione serve ALLA FINE delle operazioni di prelievo, x chiudere la lista di prelievo
+ * - controllo se la lista esiste, ed è ancora NON completata
+ * - se risulta già completata errore xché è "readOnly" la lista essendo già completata (vedere l'enum in fondo al codice)
+ * - se la lista è ok
+ * - leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
+ * - sposto TUTTI gli UDC delle righeListaPrelievo, da posizione attuale a posizione indicata da tipo lista
+ * (quindi da codCella --> IdxCella --> spostamento
+ *
+ *
+ * 2014.06.12: aggiunta x gestione PackList AS400
+ * - verifico imballi, salvo su tab movimenti gli imballi eventuali da scaricare
+ * - chiamo stored x copia dati pack list su AS400
+ * - chiamo stored che richiamerà SSIS e quindi CL di as400
+ *
+ *
+ * indico la lista come completata = 1 (true)
+ * */
+ // setup eventuali valori x rettifica
+ bool fatto = false;
+
+ esitoOperazione answ = esitoOperazione.errore;
+ int trovate = 0;
+ DS_magazzino.ElencoListePrelievoDataTable tabella;
+ DS_magazzino.ElencoListePrelievoRow riga;
+ try
+ {
+ tabella = taElencoListePrelievo.getByCodLista(CodLista);
+ riga = tabella[0];
+ trovate = tabella.Rows.Count;
+
+ // se la lista esiste...
+ if (trovate > 0)
+ {
+ // se la lista è completata
+ if (riga.CodStatoLista == (int)statoLista.completata)
+ {
+ // ricavo il codtipolista
+ string codTipoListaAttuale = riga.CodTipoLista;
+
+ // leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
+ DS_magazzino.TipoListaPrelievoDataTable tabellaTipoLista = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale);
+ DS_magazzino.TipoListaPrelievoRow rigaTipoLista = tabellaTipoLista[0];
+
+ // leggo da righe lista prelievo il dato udc che mi serve
+ DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
+ DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
+
+ // leggo il codice della cella...
+ string CodEvento = rigaTipoLista.CodEvento;
+ // posizione che devono avere (uguale) tutti gli UDC
+ int idxPosizUdcAll = 0;
+ // posizione corrente dell'UDC
int idxPosizUdcCorr = 0;
+ // posizione di destinazione per UDC corrente
int idxPosizUdcDest = 0;
- string CodEvento = "UDC_CONS";
- // calcolo posizione UDC corrente (se c'è...)
- try
+ // cella di provenienza
+ int idxCellaFrom = 0;
+ // cella di destinazione
+ int idxCellaTo = 0;
+ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * ora controllo se la lista sia DAVVERO scaricabile, cioè
+ * - destinatario IMPOSTATO
+ * - TUTTE le righe hanno una posizione di destinazione valida,
+ * OVVERO tutte le righe hanno nella tab trans posiz eventi una riga valida
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+ bool listaScaricabile = true;
+ if (riga.Destinatario == "")
{
+ listaScaricabile = false;
+ }
+ else
+ {
+ foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
+ {
+ // ricavo il codice UDC...
+ string UDC = row.UDC;
// mi serve per posizione udc corrente
DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
- // il secondo idx che mi serve
- idxCellaFrom = rigaUdcCorrente.IdxCella;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di recupero cella per l'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
- }
- // ora calcolo gli altri dati dalla riga ElencoCartellini dell'UDC
- try
- {
// calcolo posizione destinazione da state machine...
idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ if (idxPosizUdcAll == 0)
+ {
+ idxPosizUdcAll = idxPosizUdcCorr;
+ }
idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(CodEvento, idxPosizUdcCorr);
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di recupero dati posizioni from/to per l'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
- }
- // ora provo ad eseguire!
- try
- {
- if (idxPosizUdcDest != 0) // solo se c'è una posizione da cui poter fare lo scaricamento...
+ if (idxPosizUdcDest == 0 || idxPosizUdcAll != idxPosizUdcCorr)
{
- // sposto UDC
- answ = scaricaUDC(UDC, idxPosizUdcDest, CodEvento, clientIp);
+ listaScaricabile = false;
}
+ }
}
- catch (Exception e)
+ // SE la lista è scaricabile procedo...
+ if (listaScaricabile)
{
- logger.lg.scriviLog(string.Format(" | {3} | Errore in fase di scaricamento dell'UDC {0}: {1}{2}", UDC, Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
- }
-
- return answ;
- }
- ///
- /// riattiva un UDC (se permesso) da una posizione consumata ad una valida
- ///
- /// Codice UDC
- /// Cod soggetto utente
- /// IP del chiamante
- ///
- public bool riattivaUdc(string UDC, string CodSoggetto, string clientIp)
- {
- // init
- bool answ = false;
- try
- {
- // salvo dati cartellino PRE
- DS_Applicazione.ElencoCartelliniRow rigaUdcPre = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0];
- GMW_data.DataProxy.obj.taCartellini.stp_riattivaUdc(UDC, CodSoggetto);
- logger.lg.scriviLog(string.Format(" | {0} | riattivato UDC {1} | soggetto {2}", clientIp, UDC, CodSoggetto), tipoLog.INFO);
- // salvo dati cartellino POST
- DS_Applicazione.ElencoCartelliniRow rigaUdcPost = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0];
- answ = true;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {2} | Eccezione: {0}{1}", Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
- }
-
- return answ;
- }
- ///
- /// sblocca un UDC (se permesso)
- ///
- /// Codice UDC
- /// Cod soggetto utente
- /// IP del chiamante
- ///
- public bool sbloccaUdc(string UDC, string CodSoggetto, string clientIp)
- {
- // init
- bool answ = false;
- try
- {
- GMW_data.DataProxy.obj.taCartellini.stp_sbloccaUdc(UDC, CodSoggetto);
- logger.lg.scriviLog(string.Format(" | {0} | sbloccato UDC {1} | soggetto {2}", clientIp, UDC, CodSoggetto), tipoLog.INFO);
- answ = true;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {2} | Eccezione: {0}{1}", Environment.NewLine, e, clientIp), tipoLog.EXCEPTION);
- }
- return answ;
- }
- ///
- /// controlla se l'udc della qualità indicato ha benestare qualità ("S")
- ///
- ///
- ///
- public bool udcMpHasBenesQual(string UDC)
- {
- bool answ = false;
- try
- {
- DS_magazzino.RapQualRow rigaRapQual = taRapQual.getByUdc(UDC)[0];
- if (rigaRapQual.BenesQual == "S")
- {
- answ = true;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// controlla se l'udc indicato è già stato consumato
- ///
- ///
- ///
- public bool udcMpIsConsumabile(string UDC)
- {
- bool answ = false;
- try
- {
- DS_magazzino.ElencoCartelliniRow rigaUDC = taCartellini.getByUdc(UDC)[0];
- if (rigaUDC.IdxPosizione > 0)
- {
- answ = true;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce IdxPosizione dell'UDC
- ///
- ///
- ///
- public int IdxPosizioneUdc(string UDC)
- {
- int answ = 0;
- try
- {
- answ = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce il CodStato dell'UDC
- ///
- ///
- ///
- public string CodStatoUdc(string UDC)
- {
- string answ = "";
- try
- {
- answ = taCartellini.getDetailsUdcByUdc(UDC)[0].CodStato;
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce cella in cui si trova l'UDC
- ///
- ///
- ///
- public string codCellaUdc(string UDC)
- {
- string answ = "";
- try
- {
- int idxCella = taPosUdcCorr.getByUDC(UDC)[0].IdxCella;
- answ = taCelle.getByIdxCella(idxCella)[0].CodCella;
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce codBlocco in cui si trova l'UDC
- ///
- ///
- ///
- public string codBloccoUdc(string UDC)
- {
- string answ = "";
- try
- {
- int idxCella = taPosUdcCorr.getByUDC(UDC)[0].IdxCella;
- int idxBlocco = taCelle.getByIdxCella(idxCella)[0].IdxBlocco;
- answ = taBlocchi.getByIdx(idxBlocco)[0].CodBlocco;
- }
- catch
- { }
- return answ;
- }
-
- ///
- /// verifica se UDC sia ok x LDP secondo stored stp_getUdcDetailOkLP (LPA/LPX)
- ///
- ///
- ///
- public bool checkUdc_OkLPAX(string UDC)
- {
- bool answ = false;
- try
- {
- answ = taDettUDC.getByUdcOkLp(UDC).Rows.Count > 0;
- }
- catch
- { }
- return answ;
- }
- ///
- /// controlla se l'udc indicato sia in una LDP
- ///
- ///
- ///
- public bool udcInLdp(string UDC)
- {
- bool answ = false;
- try
- {
- DS_magazzino.RigheListePrelievoDataTable tabRLDP = taRigheListePrelievo.getByUdc(UDC);
- if (tabRLDP.Rows.Count > 0)
- {
- answ = true;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce il codice UDC calcolato
- ///
- ///
- ///
- /// 2 cifre
- ///
- ///
- public string getComposizioneUDC(string CodCS, string flusso, string anno, int numUDC)
- {
- string answ = "";
- try
- {
- answ = string.Format("U{0}{1}{2}{3}", CodCS, flusso, anno, numUDC.ToString().PadLeft(6, '0'));
- }
- catch
- { }
- return answ;
- }
- ///
- /// fornisce il codice trattamento calcolato
- ///
- /// se > 2 cifre trim e tiene ultime 2..
- /// Numero trattamento
- ///
- public string getCompTrattamenti(string anno, string numTr)
- {
- string answ = "";
- try
- {
- answ = string.Format("{0}{1}", anno.Substring(anno.Length - 2, 2), numTr.PadLeft(6, '0'));
- }
- catch
- { }
- return answ;
- }///
- /// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e associa ad AL e mette nella cella richiesta
- ///
- /// AL da associare
- /// AL Sorgente (da disattivare)
- /// DataMatrix da spostare
- ///
- /// codice cella destinazione
- /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa)
- /// codice anagrafico del cliente
- /// codice del particolare (articolo) - da anagrafica!
- /// Codice dell'impianto
- /// Codice dello stampo
- /// codice dell'esponente dello stampo
- /// Codice figura
- /// codice dell'UDC parent (UDC della tara)
- /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore
- /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)
- /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)
- /// codice dell'operatore
- /// numero pezzi associati all'UDC
- /// Peso totale rilevato
- /// Peso unitario rilevato
- /// Data di rif per la dichiarazione
- /// Turno di rif per la dichiarazione
- /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...)
- /// Codice del magazzino in cui inserire l'UDC
- /// NOME della posizione default in cui creare UDC
- /// cod evento da associare al movimento mag
- /// note (opzionali)
- /// cod UDC pre-calcolato, se "" verrà calcolato dalla query
- /// anno in cui intestare i cartellini, trimma a 2 cifre DX
- /// Ip del client
- /// UDC del nuovo cartellino per FINITI
- public string creaUdcWithAlCella(string AL, string SourceAL, string DataMatrix, string CodStatoUdcOut, string CodCella, string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, string defIdxPosiz, string codEvento, string note, string UDC, int anno, string clientIp)
- {
- // trim fix
- string CodBilanciaTrim = CodBilancia.Trim();
- string CodClienteTrim = CodCliente.Trim();
- string ParticolareTrim = Particolare.Trim();
- string CodImpiantoTrim = CodImpianto.Trim();
- string CodStampoTrim = CodStampo.Trim();
- string EsponenteTrim = Esponente.Trim();
- string FiguraTrim = Figura.Trim();
- string UDC_parentTrim = UDC_parent.Trim();
- string CodImballoTrim = CodImballo.Trim();
- string CodTipoDichiarazioneTrim = CodTipoDichiarazione.Trim();
- string CodSoggettoTrim = CodSoggetto.Trim();
- string CodStatoTrim = CodStato.Trim();
- string defIdxPosizTrim = defIdxPosiz.Trim();
- string codEventoTrim = codEvento.Trim();
- string noteTrim = note.Trim();
- string annoTrim = anno.ToString();
- if (annoTrim.Length > 2)
- {
- annoTrim = annoTrim.Substring(2, 2);
- }
- // determino se cancellare udcTara
- bool doDeleteUdcTara = false; // memLayer.ML.confReadBool("doDeleteUdcTara");
- // ricavo cod company...
- string CodCS = "ND";
- string answ = "NA";
- try
- {
- CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilanciaTrim)[0].CodCS;
- }
- catch
- {
- CodCS = memLayer.ML.cdv("CodCS");
- }
- int IdxPosizione = 0;
- if (CodMag > 0)
- {
- IdxPosizione = CodMag;
- }
- else
- {
- IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
- }
- // controllo di avere codice soggetto e particolare validi (!="")
- if (ParticolareTrim != "" && CodSoggettoTrim != "")
- {
- // creo nuovo cartellino!
- DS_Applicazione.ElencoCartelliniDataTable tabUdc = new DS_Applicazione.ElencoCartelliniDataTable();
- // insert nuovo UDC con codice impostato
- try
- {
- tabUdc = DataProxy.obj.taCartellini.stp_insNewFullWithAL(AL, SourceAL, DataMatrix, CodStatoUdcOut, CodCella, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
- answ = UDC;
- }
- catch (Exception exc)
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull_fixUDC, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23} | {24}{25}{26}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp, Environment.NewLine, exc), tipoLog.INFO);
- }
- // leggo la riga
- answ = tabUdc[0].UDC;
- // loggo tutto!
- if (memLayer.ML.confReadInt("_logLevel") > 5)
+ // 2015.09.18: aggiunto controllo che NON ci siano UDC con NC
+ if (taRigheListePrelievo.getUdcSenzaDelibPM(CodLista).Rows.Count == 0)
+ {
+ if (taRigheListePrelievo.getUdcConNC(CodLista).Rows.Count == 0)
{
+ if (taRigheListePrelievo.getDmtxUdcConNc(CodLista).Rows.Count == 0)
+ {
+ // scarico i vari UDC dal magazzino (come posizione corrente)
+ foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
+ {
+ // ricavo il codice UDC...
+ string UDC = row.UDC;
+ // mi serve per posizione udc corrente
+ DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
+ // il secondo idx che mi serve
+ idxCellaFrom = rigaUdcCorrente.IdxCella;
+ // calcolo posizione destinazione da state machine...
+ idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(CodEvento, idxPosizUdcCorr);
+ // a questo punto mi calcolo se c'è una cella di destinazione associata
+ try
+ {
+ idxCellaTo = MagClass.magazzino.taCelle.getByCodMag(CodCS, idxPosizUdcDest.ToString())[0].IdxCella;
+ }
+ catch
+ {
+ idxCellaTo = 0;
+ }
+ // sposto UDC, e così facendo genero movimenti batch x AS400
+ fatto = scaricaUDC(UDC, idxPosizUdcDest, CodEvento, clientIp);
+ // sposto nella PRIMA cella di destinazione associata l'UDC
+ if (idxCellaTo > 0)
+ {
+ spostaUDC(CodCS, UDC, idxCellaTo, false, clientIp);
+ }
+ if (fatto)
+ {
+ // dopo aver scaricato UDC sistemo eventuali Righe di Prelievo x lo stesso pending...
+ magazzino.taRigheListePrelievo.stp_RLP_sbloccaNonPrelevate(CodLista, UDC);
+ }
+ }
+ // ora step finali x LDP
try
{
- logger.lg.scriviLog(string.Format(" | {24} | NUOVO cartellino da postazione: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
- }
- catch
- { }
- }
- // solo se UDC parent != vuoto...
- if (UDC_parentTrim != "")
- {
- try
- {
- // salvo associazione parent-child tra UDC!
- DataProxy.obj.taRelazUDC.Insert(UDC_parentTrim, answ, DateTime.Now);
- }
- catch
- { }
- }
- }
- return answ;
- }
- ///
- /// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati
- ///
- /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa)
- /// codice anagrafico del cliente
- /// codice del particolare (articolo) - da anagrafica!
- /// Codice dell'impianto
- /// Codice dello stampo
- /// codice dell'esponente dello stampo
- /// Codice figura
- /// codice dell'UDC parent (UDC della tara)
- /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore
- /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)
- /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)
- /// codice dell'operatore
- /// numero pezzi associati all'UDC
- /// Peso totale rilevato
- /// Peso unitario rilevato
- /// Data di rif per la dichiarazione
- /// Turno di rif per la dichiarazione
- /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...)
- /// Codice del magazzino in cui inserire l'UDC
- /// NOME della posizione default in cui creare UDC
- /// cod evento da associare al movimento mag
- /// note (opzionali)
- /// cod UDC pre-calcolato, se "" verrà calcolato dalla query
- /// anno in cui intestare i cartellini, trimma a 2 cifre DX
- /// Ip del client
- /// UDC del nuovo cartellino per FINITI
- public string creaUdc(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, string defIdxPosiz, string codEvento, string note, string UDC, int anno, string clientIp)
- {
- // trim fix
- string CodBilanciaTrim = CodBilancia.Trim();
- string CodClienteTrim = CodCliente.Trim();
- string ParticolareTrim = Particolare.Trim();
- string CodImpiantoTrim = CodImpianto.Trim();
- string CodStampoTrim = CodStampo.Trim();
- string EsponenteTrim = Esponente.Trim();
- string FiguraTrim = Figura.Trim();
- string UDC_parentTrim = UDC_parent.Trim();
- string CodImballoTrim = CodImballo.Trim();
- string CodTipoDichiarazioneTrim = CodTipoDichiarazione.Trim();
- string CodSoggettoTrim = CodSoggetto.Trim();
- string CodStatoTrim = CodStato.Trim();
- string defIdxPosizTrim = defIdxPosiz.Trim();
- string codEventoTrim = codEvento.Trim();
- string noteTrim = note.Trim();
- string annoTrim = anno.ToString();
- if (annoTrim.Length > 2)
- {
- annoTrim = annoTrim.Substring(2, 2);
- }
- // determino se cancellare udcTara
- bool doDeleteUdcTara = false; // memLayer.ML.confReadBool("doDeleteUdcTara");
- // ricavo cod company...
- string CodCS = "ND";
- string answ = "NA";
- try
- {
- CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilanciaTrim)[0].CodCS;
- }
- catch
- {
- CodCS = memLayer.ML.cdv("CodCS");
- }
- int IdxPosizione = 0;
- if (CodMag > 0)
- {
- IdxPosizione = CodMag;
- }
- else
- {
- IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
- }
- //int IdxPosizione = memLayer.ML.confReadInt(defIdxPosizTrim);
- // controllo di avere codice soggetto e particolare validi (!="")
- if (ParticolareTrim != "" && CodSoggettoTrim != "")
- {
- // creo nuovo cartellino!
- DS_Applicazione.ElencoCartelliniDataTable tabUdc = new DS_Applicazione.ElencoCartelliniDataTable();
- // controllo se UDC già definito o meno...
- if (UDC != "")
- {
- // insert nuovo UDC con codice impostato
- try
- {
- tabUdc = DataProxy.obj.taCartellini.stp_insNewFull_fixUDC(UDC, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
- answ = UDC;
- }
- catch
- {
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull_fixUDC, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
- }
- }
- else
- {
- // insert con calcolo UDC
- try
- {
- tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, doDeleteUdcTara, noteTrim);
+ // STEP 1: segna come scaricata la lista prelievo
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.scaricata);
+ // STEP 2: chiamo esportazione verso MovMag AS x imballi + copiare in altra tabella (quella per AS...) i dati della packing
+ taElencoListePrelievo.stp_LP_exportToAs400(CodLista, SlotPL, CodCS);
+ // STEP 3: chiamo stored x eseguire SSIS che a sua volta richiama la CL di AS400 x importazione MovMag
+ utils.obj.taAs400.stp_processaCodaMovimPackList();
+ // restituisce ok
+ answ = esitoOperazione.ok;
}
catch (Exception exc)
{
- // loggo errore
- logger.lg.scriviLog(string.Format("ERRORE CREAZIONE UDC: | {24} | procedura stp_insNewFull, parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}{25}{26}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp, Environment.NewLine, exc), tipoLog.EXCEPTION);
+ logger.lg.scriviLog(string.Format("Errore in trasferimento dati LDP verso AS400: {0}", exc), tipoLog.EXCEPTION);
}
+ }
+ else
+ {
+ answ = esitoOperazione.errore_DtmxNc;
+ }
}
- // leggo la riga
- answ = tabUdc[0].UDC;
- // loggo tutto!
- if (memLayer.ML.confReadInt("_logLevel") > 5)
+ else
{
- try
- {
- logger.lg.scriviLog(string.Format(" | {24} | NUOVO cartellino da postazione: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22} | {23}", answ, CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.INFO);
- }
- catch
- { }
- }
- // solo se UDC parent != vuoto...
- if (UDC_parentTrim != "")
- {
- try
- {
- // salvo associazione parent-child tra UDC!
- DataProxy.obj.taRelazUDC.Insert(UDC_parentTrim, answ, DateTime.Now);
- }
- catch
- { }
+ answ = esitoOperazione.errore_UdcNc;
}
+ }
+ else
+ {
+ answ = esitoOperazione.errore_noDeliberPM;
+ }
}
else
{
- logger.lg.scriviLog(string.Format(" | {24} | CodSoggetto / particolare non validi! tentativo di creazione cartellino come {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} | {13} | {14} | {15} | {16} | {17} | {18} | {19} | {20} | {21} | {22}", CodCS, CodBilanciaTrim, annoTrim, CodClienteTrim, ParticolareTrim, CodImpiantoTrim, CodStampoTrim, EsponenteTrim, FiguraTrim, DataRif, TurnoRif, CodImballoTrim, CodSoggettoTrim, Tara, IdxPosizione, CodTipoDichiarazioneTrim, codEventoTrim, Quantita, PesoTot, PesoCad, CodStatoTrim, UDC_parentTrim, noteTrim, clientIp), tipoLog.ERROR);
+ answ = esitoOperazione.errore_nonScaricabile;
}
- return answ;
+ }
+ // se è già completata dà errore
+ else
+ {
+ answ = esitoOperazione.errore_readOnly;
+ }
}
- ///
- /// associa udc all'UDCParent
- ///
- /// UDC destinazione
- /// UDC parent
- ///
- public bool associaUdcParent(string codUdc, string codParent)
+ // se la lista non esiste dai errore
+ else
{
- bool answ = false;
- try
- {
- answ = associaUdcParent(codUdc, codParent, false);
- }
- catch
- { }
- return answ;
- }
- ///
- /// VERIFICA se ci sia associazione tra udc e l'UDCParent e restituisce TRUE se sia già associato
- ///
- /// UDC destinazione
- /// UDC parent
- ///
- public bool checkAssociazioneUdcParent(string codUdc, string codParent)
- {
- bool answ = false;
- try
- {
- answ = DataProxy.obj.taRelazUDC.getByParentChild(codUdc, codParent).Rows.Count > 0;
- }
- catch
- { }
- return answ;
- }
- ///
- /// calcola l'UDC Parent di quello fornito
- ///
- /// UDC destinazione
- /// UDC parent
- ///
- public string getUdcParent(string codUdc)
- {
- string answ = "";
- try
- {
- answ = ((DS_Applicazione.RelazUDCRow)DataProxy.obj.taRelazUDC.stp_getParent(codUdc)[0]).UDC_parent;
- }
- catch
- { }
- return answ;
- }
- ///
- /// calcola l'UDC Parent di quello fornito IN ORDINE DESCENDING
- ///
- /// UDC destinazione
- /// UDC parent
- ///
- public string getUdcParentDesc(string codUdc)
- {
- string answ = "";
- try
- {
- answ = ((DS_Applicazione.RelazUDCRow)DataProxy.obj.taRelazUDC.stp_getParentDesc(codUdc)[0]).UDC_parent;
- }
- catch
- { }
- return answ;
- }
- ///
- /// associa udc all'UDCParent
- ///
- /// UDC destinazione
- /// UDC parent
- /// copiare si/no attributi UDC da parent a child
- ///
- public bool associaUdcParent(string codUdc, string codParent, bool copyAttr)
- {
- bool answ = false;
- try
- {
- DataProxy.obj.taCartellini.stp_UDC_associaParent(codUdc, codParent, CodSoggCurrUser, copyAttr);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// effettua la stampa di un dato UDC
- ///
- /// Codice UDC
- /// stampante specifica (da postazioen o std da webconfig, a cura dell'utente
- /// IP del chiamante
- ///
- public bool stampaUdc(string UDC, string printer, tipoCartellino tipoCart, string clientIp)
- {
- bool answ = false;
- // controllo se esista UDC
- if (checkUDC(UDC))
- {
- answ = reportPrinter.obj.stampaCartellino(tipoCart, UDC, printer);
- logger.lg.scriviLog(string.Format(" | {0} | stampato UDC {1} | stampante {2} | tipo {3}", clientIp, UDC, printer, tipoCart), tipoLog.INFO);
- }
- return answ;
+ answ = esitoOperazione.errore;
}
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// resetta (riporta in bozza) una lista di prelievo, spostando gli UDC alla posizione standard precedente
+ ///
+ /// Codice company/sito
+ /// codice della lista di prelievo
+ /// cod operatore carrellista
+ /// IP del client
+ ///
+ public esitoOperazione resetListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp)
+ {
+ memLayer.ML.emptySessionVal("CodListaAttiva");
+ memLayer.ML.emptySessionVal("activeTask");
+ // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
+ esitoOperazione answ = esitoOperazione.errore;
+ // posizione corrente dell'UDC
+ int idxPosizUdcAll = 0; // posizione che devono avere (uguale) tutti gli UDC
+ int idxPosizUdcCorr = 0;
+ int IdxPosizioneTo = 0;
+ int idxPosizUdcDest = 0;
+ int idxCellaTo = 0;
+ try
+ {
+ // la query recupera la lista in base al CodLista
+ DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
- ///
- /// effettua la Ristampa di un dato UDC partendo dal primo tipo di cartellino stampato...
- ///
- /// Codice UDC
- /// stampante specifica (da postazioen o std da webconfig, a cura dell'utente
- /// IP del chiamante
- ///
- public bool ristampaUdc(string UDC, string printer, string clientIp)
+ // se la lista esiste...
+ if (tabella.Rows.Count > 0)
{
- bool answ = false;
- tipoCartellino tipoCart = tipoCartellino.cartND;
- try
+ // ricontrollo che la lista sia completata
+ if (riga.CodStatoLista >= (int)statoLista.completata)
+ {
+ // calcolo tipo lista di prelievo
+ string codTipoListaAttuale = riga.CodTipoLista;
+ // dal tipo lista determino l'evento
+ string codEvento = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale)[0].CodEvento;
+ // 2014.07.10 ATTENZIONE cablato evento reset come Pre --> Rst
+ codEvento = codEvento.Replace("Pre", "Rst");
+ // leggo da righe lista prelievo il dato udc che mi serve
+ DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
+ DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
+
+ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * ora controllo se la lista sia DAVVERO scaricabile, cioè
+ * - destinatario IMPOSTATO
+ * - TUTTE le righe hanno una posizione di destinazione valida,
+ * OVVERO tutte le righe hanno nella tab trans posiz eventi una riga valida
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+ bool listaScaricabile = true;
+ if (riga.Destinatario == "")
{
- tipoCart = (tipoCartellino)Enum.Parse(typeof(tipoCartellino), DataProxy.obj.taPJQ.getFirstByUdc(UDC)[0].TipoCart);
+ listaScaricabile = false;
}
- catch
- { }
- if (tipoCart != tipoCartellino.cartND)
+ else
{
- // controllo se esista UDC
- if (checkUDC(UDC))
+ foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
+ {
+ // ricavo il codice UDC...
+ string UDC = row.UDC;
+ //// mi serve per posizione udc corrente
+ //DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
+ // calcolo posizione destinazione da state machine...
+ idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
+ if (idxPosizUdcAll == 0)
{
- answ = reportPrinter.obj.stampaCartellino(tipoCart, UDC, printer);
- logger.lg.scriviLog(string.Format(" | {0} | stampato UDC {1} | stampante {2} | tipo {3}", clientIp, UDC, printer, tipoCart), tipoLog.INFO);
+ idxPosizUdcAll = idxPosizUdcCorr;
}
- }
- return answ;
- }
- ///
- /// restituisce particolare da UDC
- ///
- ///
- ///
- public string getParticolareByUDC(string UDC)
- {
- string answ = "";
- try
- {
- answ = (taCartellini.getDetailsUdcByUdc(UDC)[0].Particolare);
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce note dell'UDC
- ///
- ///
- ///
- public string getNoteByUDC(string UDC)
- {
- string answ = "";
- try
- {
- answ = (taCartellini.getDetailsUdcByUdc(UDC)[0].Note);
- }
- catch
- { }
- return answ;
- }
- ///
- /// aggiorna note dell'UDC
- ///
- ///
- ///
- public void updateNoteUDC(string UDC, string note)
- {
- taCartellini.updateNote(UDC, note, CodSoggCurrUser);
- }
- ///
- /// aggiorna posizione dell'UDC
- ///
- ///
- ///
- public void updatePosizioneUDC(string UDC, int idxPosizione)
- {
- taCartellini.updateIdxPosizione(UDC, idxPosizione, CodSoggCurrUser);
- }
- ///
- /// aggiorna note e posizione dell'UDC
- ///
- ///
- ///
- ///
- public void updateNotePosizioneUDC(string UDC, string note, int idxPosizione)
- {
- taCartellini.updateNotePosizione(UDC, idxPosizione, note, CodSoggCurrUser);
- }
- ///
- /// aggiorna note, posizione e data fusione dell'UDC
- ///
- ///
- ///
- ///
- ///
- public void updateNotePosizioneDataUDC(string UDC, string note, int idxPosizione, DateTime DataFus)
- {
- taCartellini.updateNotePosizioneData(UDC, idxPosizione, note, CodSoggCurrUser, DataFus);
- }
- ///
- /// aggiorna note, posizione e data fusione dell'UDC
- ///
- ///
- ///
- ///
- ///
- ///
- public void updateNotePosizioneDataImballoUDC(string UDC, string note, int idxPosizione, DateTime DataFus, string CodImballo)
- {
- taCartellini.updateNotePosizioneDataImballo(UDC, idxPosizione, note, CodSoggCurrUser, DataFus, CodImballo);
- }
- ///
- /// aggiorna note, posizione e data fusione dell'UDC
- ///
- ///
- ///
- ///
- ///
- ///
- public void updateFinDtxFull(string UDC, string note, DateTime DataFus, string CodImballo, string AL)
- {
- taCartellini.finDatamatrixFullUpdate(AL, UDC, CodImballo, note, DataFus, CodSoggCurrUser);
- }
- ///
- /// Verifica se UDC abbia attributo indicato
- ///
- ///
- ///
- ///
- public bool udcHasAttr(string UDC, string CodAttr)
- {
- bool answ = false;
- try
- {
- answ = MagClass.magazzino.taAtt2UDC.getByUdc(UDC).Select(string.Format("CodAttr = '{0}'", CodAttr)).Length > 0 ? true : false;
- }
- catch
- { }
- return answ;
- }
-
- #endregion
-
- #region procedure di verifica e traduzione dati da anagrafiche
-
- ///
- /// Verifica la corrispondenza dati tra RigheListePrelievo ed ElencoCartellini
- ///
- ///
- ///
- ///
- public bool verificaDatiUdc(string CodLista, string UDC)
- {
- bool answ = false;
-
- try
- {
- DS_magazzino.ElencoListePrelievoDataTable tabellaElenco = taElencoListePrelievo.getByCodLista(CodLista);
- DS_magazzino.ElencoListePrelievoRow rigaElenco = tabellaElenco[0];
-
- DS_magazzino.ElencoCartelliniDataTable tabellaUDC = taCartellini.getDetailsUdcByUdc(UDC);
- DS_magazzino.ElencoCartelliniRow rigaUDC = tabellaUDC[0];
-
- // ricavo dati da confrontare - da Lista ricavo particolare/esponente/figura
- string particolareLista = rigaElenco.Particolare.Trim();
- string esponenteLista = rigaElenco.Esponente.Trim();
- string figuraLista = rigaElenco.Figura.Trim();
- string CodImballoLista = rigaElenco.CodImballo.Trim();
-
- //stessi dati da UDC
- string particolareUDC = rigaUDC.Particolare.Trim();
- string esponenteUDC = rigaUDC.Esponente.Trim();
- string figuraUDC = rigaUDC.Figura.Trim();
- string CodImballoUDC = rigaUDC.CodImballo.Trim();
-
- // condizioni di uguaglianza...
- bool particolareOk = false;
- bool esponenteOk = false;
- bool figuraOk = false;
- bool CodImballoOk = false;
- // verifico le condizioni 1 ad 1...
- particolareOk = (particolareLista == particolareUDC);
- if (esponenteLista == "*")
+ idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(codEvento, idxPosizUdcCorr);
+ if (idxPosizUdcDest == 0 || idxPosizUdcAll != idxPosizUdcCorr)
{
- esponenteOk = true;
+ listaScaricabile = false;
}
- else
- {
- esponenteOk = (esponenteLista == esponenteUDC);
- }
- if (figuraLista == "*")
- {
- figuraOk = true;
- }
- else
- {
- figuraOk = (figuraLista == figuraUDC);
- }
- if (CodImballoLista == "*")
- {
- CodImballoOk = true;
- }
- else
- {
- CodImballoOk = (CodImballoLista == CodImballoUDC);
- }
-
- // verifica finale del risultato uguaglianza...
- answ = (particolareOk && esponenteOk && figuraOk && CodImballoOk);
+ }
}
- catch
+ // procedo SOLO se lista scaricabile...
+ if (listaScaricabile)
{
- answ = false;
- }
-
- return answ;
- }
- ///
- /// restituisce codice soggetto dell'user corrente
- ///
- ///
- public string CodSoggCurrUser
- {
- get
- {
- // ricavo da session...
- string CodSoggetto = "";
+ // Modifica x gestione "blocco " da stato LDP: PRIMA passo a bozza...
+ taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.bozza);
+ // sposto ("metto a terra") gli UDC
+ string _UDC = "";
+ foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
+ {
+ // ricavo il codice UDC...
+ _UDC = row.UDC;
+ // posizione corrente
+ idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(_UDC)[0].IdxPosizione;
+ // calcolo posizione destinazione da state machine...
try
{
- CodSoggetto = memLayer.ML.StringSessionObj("CodSoggetto");
+ IdxPosizioneTo = StateMachine.SM.taTTPE.getByEventoPosizione(codEvento, idxPosizUdcCorr)[0].IdxPosizioneTo;
}
- catch (Exception e)
+ catch (Exception exc)
{
- logger.lg.scriviLog(string.Format("Non sono riuscito a recuperare il codice soggetto DALLA SESSIONE per l'utente loggato: {0}, errore {1}{2}", user_std.UtSn.userNameAD, Environment.NewLine, e), tipoLog.ERROR);
+ IdxPosizioneTo = 0;
+ logger.lg.scriviLog(string.Format(" | {1} | Errore in reset lista prelievo nel calcolo IdxPosizioneTo: {0}", exc, clientIp), tipoLog.EXCEPTION);
}
- if (CodSoggetto == "")
- {
- // provo a recuperare da cookie...
- CodSoggetto = memLayer.ML.getCookieVal("CodSoggetto");
- }
- if (CodSoggetto == "")
+ if (IdxPosizioneTo != 0)
{
+ // lo trasformo x avere la cella di destinazione...
+ if (idxPosizUdcCorr < 0)
+ {
+ // se parto da cella negativa (consumato) calcolo destinazione da cella TO...
+ idxCellaTo = taCelle.getFirstByPosizione(IdxPosizioneTo.ToString())[0].IdxCella;
+ }
+ else
+ {
try
{
- CodSoggetto = DataProxy.obj.taSogg2Oper.getByUserDominio(user_std.UtSn.utente, user_std.UtSn.dominio)[0].CodSoggetto;
- // salvo in sessione...
- memLayer.ML.setSessionVal("CodSoggetto", CodSoggetto);
+ // altrimenti uso la posizione corrente (NON faccio vero spostamento...
+ idxCellaTo = taCelle.getFirstByPosizione(idxPosizUdcCorr.ToString())[0].IdxCella;
}
- catch (Exception e)
+ catch
{
- logger.lg.scriviLog(string.Format("Non sono riuscito a recuperare il codice soggetto per l'utente loggato: {0}, errore {1}{2}", user_std.UtSn.userNameAD, Environment.NewLine, e), tipoLog.ERROR);
+ // se parto da cella negativa (consumato) calcolo destinazione da cella TO...
+ idxCellaTo = taCelle.getFirstByPosizione(IdxPosizioneTo.ToString())[0].IdxCella;
}
+ }
+ // sposto UDC
+ spostaUDC(CodCS, _UDC, idxCellaTo, false, clientIp);
+ // 2014.07.09: modifica, per NON impostare da tab del magazzino con sposta fa update posizione esplicita
+ taCartellini.updateIdxPosizione(_UDC, IdxPosizioneTo, CodSoggCurrUser);
}
- return CodSoggetto;
+ }
+ // indico le righe come NON prelevate...
+ taRigheListePrelievo.stp_RLP_resetPrelevate(CodLista);
+ //// aggiorno stato lista che torna a BOZZA
+ //taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.bozza);
+ answ = esitoOperazione.ok;
+ logger.lg.scriviLog(string.Format(" | {0} | resettata lista di prelievo UDC {1} | utente {2} | tipo {2}", clientIp, CodLista, CodSoggetto), tipoLog.INFO);
}
+ else
+ {
+ // loggo che c'è anomalia
+ answ = esitoOperazione.errore_readOnly;
+ logger.lg.scriviLog(string.Format(" | {0} | Errore in reset lista prelievo: non è stato possibile resettare per la posizione di almeno un UDC", clientIp), tipoLog.EXCEPTION);
+ }
+ }
+ // se è già completata o NON iniziata dà errore
+ else
+ {
+ answ = esitoOperazione.errore_readOnly;
+ }
}
- ///
- /// restituisce l'IdxCella dato il CodCella
- ///
- /// Codice company/sito
- ///
- ///
- public int IdxCellaByCodCella(string CodCS, string CodCella)
+ // se la lista non esiste dai errore
+ else
{
- int answ = 0;
+ answ = esitoOperazione.errore;
+ }
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {1} | Errore in reset lista prelievo: {0}", e, clientIp), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+
+
+ ///
+ /// Conferma che un dato UDC è stato prelevato per soddisfare la lista di prelievo ed aggiorna o aggiunge riga in RigheListePrelievo
+ ///
+ /// codice della lista di prelievo
+ /// Codice UDC
+ /// esito comando
+ public esitoOperazione confermaUdcPrelevatoPerLista(string CodLista, string UDC)
+ {
+ esitoOperazione answ = esitoOperazione.errore;
+
+ // verifico che i dati corrispondano con il metodo relativo (vedi sopra)
+ bool datiUdcOk = verificaDatiUdc(CodLista, UDC);
+
+ if (datiUdcOk)
+ {
+ // richiamo stored di upsert
+ taRigheListePrelievo.upsertPrelevato(CodLista, UDC);
+ // ...dò risposta positiva
+ answ = esitoOperazione.ok;
+
+ }
+ else
+ {
+ // altrimenti dò errore mismatch e non proseguo
+ return answ = esitoOperazione.errore_mismatch;
+ }
+
+ return answ;
+ }
+ ///
+ /// annulla il prelievo di un UDC, aggiornando RigheListePrelievo (solo preventivato...)
+ ///
+ /// codice della lista di prelievo
+ /// Codice UDC
+ /// esito comando
+ public esitoOperazione annullaUdcPrelevatoPerLista(string CodLista, string UDC)
+ {
+ esitoOperazione answ = esitoOperazione.errore;
+
+ /*
+ * Questa funzione va chiamata da web o da terminalino ogni volta che si fa un annullamento di avvenuto prelievo, ovvero il carrellista ha ANNULLATO un prelievo di un UDC associato ad una lista
+ *
+ * - in primis controllo: esiste questa riga di prelievo udc/lista?
+ * - se i dati non corrispondono esco e mando falso --> vedere l'enum in fondo al codice ed
+ * usare esitoOperazione.errore_mismatch
+ * - se i dati corrispondono allora
+ * - cerco riga e tolgo check come prelevato
+ * - se tutto ok passo esito ok
+ *
+ * */
+ try
+ {
+ // ricavo dati
+ DS_magazzino.RigheListePrelievoDataTable tabella = taRigheListePrelievo.getByCodLista(CodLista);
+ DS_magazzino.RigheListePrelievoRow riga = tabella[0];
+
+ // se i dati esistono procedo - eseguo stored che setta non prelevato = false per la riga selezionata
+ if (tabella.Rows.Count > 0)
+ {
+ taRigheListePrelievo.setAnnullaUdcPrelevato(CodLista, UDC);
+ answ = esitoOperazione.ok;
+ }
+
+ else
+ {
+ answ = esitoOperazione.errore_mismatch;
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Rigenera una Lista di prelievo togliendo gli UDC non ancora prelevati rimettendo in logica FIFO gli UDC "liberi" disponibili
+ ///
+ /// codice della lista di prelievo
+ /// esito comando
+ public esitoOperazione scambiaUdcPerLista(string CodLista)
+ {
+ esitoOperazione answ = esitoOperazione.errore;
+
+ /*
+ * Questa funzione va chiamata da web o da terminalino ogni volta che si fa una richiesta di cambio per un UDC già prelevato, ovvero un altro carrellista prelevato un UDC associato alla mia lista corrente - rigenera UDC da prelevare
+ * */
+ try
+ {
+ // ricavo dati
+ DS_magazzino.ElencoListePrelievoRow riga = taElencoListePrelievo.getByCodLista(CodLista)[0];
+ // svuoto PRIMA gli UDC non prelevati
+ taRigheListePrelievo.stp_RigheListePrelievo_eliminaNonPrelevate(CodLista);
+ // rigenero righe UDC da prelevare
+ DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = taCartellini.getUdcUnusedOlder(CodLista);
+ allocaRigheListaPrelievo(riga.QtaTot, CodLista, tabellaElencoCartellini);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Aggiunge UN SOLO UDC in logica FIFO tra gli UDC "liberi" disponibili
+ ///
+ /// codice della lista di prelievo
+ /// esito comando
+ public esitoOperazione addUdcPerLista(string CodLista)
+ {
+ esitoOperazione answ = esitoOperazione.errore;
+ try
+ {
+ // ricavo dati
+ DS_magazzino.ElencoListePrelievoRow riga = taElencoListePrelievo.getByCodLista(CodLista)[0];
+ // rigenero righe UDC da prelevare
+ DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = new DS_magazzino.ElencoCartelliniDataTable();
+ // aggiungo l'UDC + vecchio (se c'è)
+ try
+ {
+ tabellaElencoCartellini.ImportRow(taCartellini.getUdcUnusedOlder(CodLista)[0]);
+ }
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(String.Format("Errore in aggiunta UDC a lista prelievo: {0}", e), tipoLog.EXCEPTION);
+ }
+ allocaRigheListaPrelievo(riga.QtaTot, CodLista, tabellaElencoCartellini);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// vero/falso che l'utent eha una lista di prelievo attiva
+ ///
+ public bool userHasActiveLP
+ {
+ get
+ {
+ bool answ = false;
+ try
+ {
+ answ = (MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser).Rows.Count > 0);
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// codice della lista di prelievo attiva
+ ///
+ public string codListaAttivaUtente
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser)[0].CodLista;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool listaPrelevabile(string CodLista)
+ {
+ bool answ = false;
+ try
+ {
+ answ = (MagClass.magazzino.taElencoListePrelievo.getByCodLista(CodLista).Select("CodStatoLista = 1").Length > 0); // filtro su stato = 1 (può esser presa in carico)
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ #endregion
+
+ #region area rapporti qualità
+
+ ///
+ /// Crea gli UDC da associare ai cartellini dei rapporti qualità deliberati, li associa e se richiesto lancia stampa
+ ///
+ /// identificativo rapp qualità
+ /// true/false se stampare
+ /// IP del client
+ ///
+ public bool creaUdcDaRappQualita(int numRapQual, string note, bool doPrint, string printerName, string clientIp)
+ {
+ bool answ = false;
+ string CodStato = "";
+ // ottengo elenco righe dei cartellini del rapp qualità indicato SENZA righe UDC
+ DS_magazzino.RapQualDataTable tabRapQual = taRapQual.getByNumRapQualNoUdc(numRapQual);
+ // per prima cosa verifico che ci sia il rapporto di qualità in esame e che abbia righe da associare ad UDC
+ if (tabRapQual.Rows.Count > 0)
+ {
+ string UDC = "";
+ foreach (DS_magazzino.RapQualRow rqRow in tabRapQual)
+ {
+ // se non ha già un UDC... e se NON E' stato già scaricato...
+ if (rqRow.UDC == "" && rqRow.LegaScaric.ToUpper() == "N")
+ {
+ answ = true;
+ // controllo se sia con benestare, se "N" imposto con stato Non accettata (da web.config) altrimenti con stato MP ok...
+ if (rqRow.BenesQual == "N")
+ {
+ CodStato = memLayer.ML.confReadString("CodStatoMP-NA");
+ }
+ else
+ {
+ CodStato = memLayer.ML.confReadString("CodStatoMP");
+ }
+ // per ogni riga creo un UDC
+ DS_Applicazione.ElencoCartelliniDataTable tabCartellini = DataProxy.obj.taCartellini.stp_insNewFull(memLayer.ML.cdv("CodCS"), memLayer.ML.confReadString("BilanciaMP"), string.Format("{0:yy}", DateTime.Now), rqRow.CodFor, rqRow.CodLega, "", "", "", "", DateTime.Now, 0, memLayer.ML.cdv("CodImballoMP"), CodSoggCurrUser, 0, memLayer.ML.cdvi("IdxPosizMP"), "M", "UDC_MP", rqRow.Qta, Convert.ToDouble(rqRow.Qta), 1, CodStato, rqRow.ProgUDC, false, note); // UDC_MP HARD CODED!!!
try
{
- answ = taCelle.getByCodCella(CodCella)[0].IdxCella; // NON controllo il CodCS...
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce il CodCella dato l'IdxCella
- ///
- /// Codice company/sito
- ///
- ///
- public string CodCellaByIdxCella(string CodCS, int IdxCella)
- {
- string answ = "";
- try
- {
- answ = taCelle.getByIdxCella(IdxCella)[0].CodCella; // NON controllo il CodCS...
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se la cella indicata sia attiva
- ///
- /// Codice company/sito
- ///
- ///
- public bool cellaAttiva(string CodCS, int IdxCella)
- {
- bool answ = false;
- try
- {
- answ = taCelle.getByIdxCella(IdxCella)[0].Attiva; // NON controllo il CodCS...
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se la cella indicata sia piena
- ///
- /// Codice company/sito
- ///
- ///
- public bool cellaPiena(string CodCS, int IdxCella)
- {
- bool answ = false; //default non piena = permette caricamento
- int idxTipoCella = 0;
- bool checkPiena = true;
- try
- {
- // controllo il tipo cella, se richiede check piena (altrimenti do ok...)
- idxTipoCella = taCelle.getByIdxCella(IdxCella)[0].IdxTipoCella;
- checkPiena = taTipoCella.getByIdx(idxTipoCella)[0].CheckPiena;
- }
- catch
- { }
- if (checkPiena)
- {
- try
- {
- // faccio controllo effettivo cella piena
- answ = taCelle.getByIdxCella(IdxCella)[0].Piena; // NON controllo il CodCS...
- }
- catch
- { }
- }
- return answ;
- }
- ///
- /// restituisce cod UDC associato ad una cella
- ///
- /// Codice company/sito
- ///
- ///
- public string udcInCella(string CodCS, int IdxCella)
- {
- string answ = "";
- try
- {
- answ = taPosUdcCorr.getByIdxCella(IdxCella)[0].UDC;
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica la cella indicata sia valida, ovvero esistente
- ///
- ///
- ///
- public bool checkCella(string CodCella)
- {
- bool answ = false;
- try
- {
- answ = (taCelle.getByCodCella(CodCella).Rows.Count > 0);
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se il particolare indicato sia valido, ovvero esistente
- ///
- /// Codice company/sito
- ///
- ///
- public bool checkParticolare(string CodCS, string Particolare)
- {
- bool answ = false;
- try
- {
- answ = (utils.obj.taSelParticolari.getByConditioValue(Particolare, "*").Rows.Count > 0);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in check particolare:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- return answ;
- }
- ///
- /// restituisce il num di UDC che corrispondono alla richiesta indicata
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public int numUdcDaPart(string CodCS, string Particolare, string codEsponente, string codFigura, string CodImballo, string codTipoLista)
- {
- int answ = 0;
- try
- {
- answ = taVParticolariOverwiew.getByDatiListaPrelievo(Particolare, CodCS, codEsponente, codFigura, CodImballo, codTipoLista)[0].NumUDC;
- }
- catch
- { }
- return answ;
- }
- ///
- /// verifica se l'UDC sia riattivabile, ovvero
- /// - sia permesso da web.config
- /// - l'UDC sia in un mag che permette riattivazione
- ///
- ///
- ///
- public bool udcIsRiattivabile(string UDC)
- {
- bool answ = false;
- // se permesso da web config controllo
- if (memLayer.ML.confReadBool("riattUdcPermessa"))
- {
- try
- {
- // recupero posizione attuale
- int IdxPosizione = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
- // verifico se riattivabile
- answ = taAnagPos.getByIdxPosizione(IdxPosizione)[0].IsRiattivaEnabled;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format("Errore nella riattivazione dell'UDC {0}:{1}{2}", UDC, Environment.NewLine, e), tipoLog.EXCEPTION);
- }
- }
- return answ;
- }
-
- #endregion
-
- #region liste di prelievo
-
- ///
- /// Crea una lista di prelievo andando a prenotare gli UDC del particolare richiesto in logica FIFO
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string creaListaPrelievo(string CodCS, string TipoListaPrelievo, string Particolare, string Esponente, string Figura, decimal QtaTot, string CodImballo, string Destinatario, string DestinatarioDescrizione)
- {
- /*
- * - ordini gli UDC per data dal + vecchio (data fusione? direi di si!)
- *
- * - prenda 1 ad 1 gli UDC, e crei dall'UDC un record in RigheListePrelievo con
- * - CodLista (dal record appena generato)
- * - UDC (il + vecchio trovato)
- * - QTA (dell'UDC)
- * - Proposto = 1 (vero)
- * - Prelevato = 0 (falso)
- * - questo loop di prelievo va eseguito fino a quanto la somam delle qty sia maggiore o uguale alla qty richiesta, o fino a quando siano finiti gli UDC
- *
- * - potrebbe esser cambiato approccio e si potrebbe fare una query ceh seleziona i + vecchi UDC in numero corretto fin dall'inizio da includere facendo una cosa del tipo
- * - calcolo media qty degli UDC papabili x le condizioni dette prima
- * - dato il totale ottengo quanti UDC mi servono arrotondando x eccesso (se ho 200 richiesti, media 70, CEIL(200/70) = 3)
- * - faccio un SELECT TOP n (qui 3) * FROM ElencoCartellini WHERE ...
- * - e questa select la uso x farci un INSERT INTO in RigheListePrelievo
- *
- * - terminati questi step si aggiorna la lista di prelievo emttendo come qty quella data dalla somma degli UDC davvero proposti
- *
- * - la stored deve restituire il codice della lista di prelievo e passarla qui, che a sua volta passerà al chiamante il codice della lista
- * */
-
- string answ = "K";
-
- // variabile di tipo datetime per data corrente
- DateTime adesso = DateTime.Now;
- // non la valorizzo qui ma calcolo ... se non fa verificare
- string RagioneSociale = "";
-
- // ricavo da session...
- string CodSoggetto = CodSoggCurrUser;
- // proseguo SOLO se ho trovato cod soggetto...
- if (CodSoggetto != "")
- {
- // li ricavo da db successivamente
- string DisegnoGrezzo = "";
- string DescParticolare = "";
- string codCliente = "";
-
-
- // ricavo codCliente
- try
- {
- codCliente = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].CodCliente;
- }
- catch { }
-
- // ricavo DisegnoGrezzo
- try
- {
- DisegnoGrezzo = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DisegnoGrezzo;
- }
- catch { }
-
- try
- {
- DescParticolare = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DescParticolare;
- }
- catch { }
-
- // dato codcliente ricavo la ragione sociale
- try
- {
- RagioneSociale = DataProxy.obj.taAnagClienti.getRagioneSocialeByCodCliente(codCliente)[0].RagSociale;
- }
- catch { }
-
-
- string codListaAttuale = "";
- try
- {
- // eseguo soltanto la query (meglio con try catch così se non c'è non dà errore...)
- DS_magazzino.ElencoListePrelievoDataTable tabellaElencoListe = taElencoListePrelievo.InsertQuery(string.Format("{0:yy}", adesso), string.Format("{0:MM}", adesso), TipoListaPrelievo, memLayer.ML.cdv("CodCS"), codCliente, RagioneSociale, CodSoggetto, Particolare, DescParticolare, DisegnoGrezzo, Esponente, Figura, CodImballo, QtaTot, Destinatario, DestinatarioDescrizione);
-
- // ricavo prima (e unica) riga dalla select
- DS_magazzino.ElencoListePrelievoRow rigaElencoListe = tabellaElencoListe[0];
-
- // ricavo valore del CodLista attuale appena inserito
- codListaAttuale = rigaElencoListe.CodLista;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format("Eccezione creazione lista prelievo: {0}{1}", Environment.NewLine, e), tipoLog.ERROR);
- }
- if (codListaAttuale != "")
- {
- answ = codListaAttuale;
- DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = taCartellini.getUdcUnusedOlder(codListaAttuale);
- allocaRigheListaPrelievo(QtaTot, codListaAttuale, tabellaElencoCartellini);
- }
- }
- return answ;
- }
- ///
- /// Crea una lista di prelievo andando a prenotare gli UDC del particolare richiesto in logica FIFO
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string creaListaPrelievoSmart(string CodCS, string TipoListaPrelievo, string Particolare, string Esponente, string Figura, decimal QtaTot, string CodImballo, string Destinatario, string DestinatarioDescrizione)
- {
- string answ = "K";
-
- // variabile di tipo datetime per data corrente
- DateTime adesso = DateTime.Now;
- // non la valorizzo qui ma calcolo ... se non fa verificare
- string RagioneSociale = "";
-
- // ricavo da session...
- string CodSoggetto = CodSoggCurrUser;
- // proseguo SOLO se ho trovato cod soggetto...
- if (CodSoggetto != "")
- {
- // li ricavo da db successivamente
- string DisegnoGrezzo = "";
- string DescParticolare = "";
- string codCliente = "";
-
-
- // ricavo codCliente
- try
- {
- codCliente = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].CodCliente;
- }
- catch { }
-
- // ricavo DisegnoGrezzo
- try
- {
- DisegnoGrezzo = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DisegnoGrezzo;
- }
- catch { }
-
- try
- {
- DescParticolare = DataProxy.obj.taAnagParticolari.getByParticolare(Particolare)[0].DescParticolare;
- }
- catch { }
-
- // dato codcliente ricavo la ragione sociale
- try
- {
- RagioneSociale = DataProxy.obj.taAnagClienti.getRagioneSocialeByCodCliente(codCliente)[0].RagSociale;
- }
- catch { }
-
-
- string codListaAttuale = "";
- try
- {
- // eseguo soltanto la query (meglio con try catch così se non c'è non dà errore...)
- DS_magazzino.ElencoListePrelievoDataTable tabellaElencoListe = taElencoListePrelievo.InsertQuery(string.Format("{0:yy}", adesso), string.Format("{0:MM}", adesso), TipoListaPrelievo, memLayer.ML.cdv("CodCS"), codCliente, RagioneSociale, CodSoggetto, Particolare, DescParticolare, DisegnoGrezzo, Esponente, Figura, CodImballo, QtaTot, Destinatario, DestinatarioDescrizione);
-
- // ricavo prima (e unica) riga dalla select
- DS_magazzino.ElencoListePrelievoRow rigaElencoListe = tabellaElencoListe[0];
-
- // ricavo valore del CodLista attuale appena inserito
- codListaAttuale = rigaElencoListe.CodLista;
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format("Eccezione creazione lista prelievo: {0}{1}", Environment.NewLine, e), tipoLog.ERROR);
- }
- if (codListaAttuale != "")
- {
- answ = codListaAttuale;
- }
- }
- return answ;
- }
- ///
- /// indica come attivata in carico di una lista di prelievo
- ///
- /// Codice company/sito
- /// codice della lista di prelievo
- /// cod operatore carrellista
- ///
- public esitoOperazione attivaListaPrelievo(string CodCS, string CodLista, string CodSoggetto)
- {
- // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
- esitoOperazione answ = esitoOperazione.errore;
- try
- {
- // la query recupera la lista in base al CodLista
- DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
- DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
-
- // se la lista esiste...
- if (tabella.Rows.Count > 0)
- {
- // se la lista è ancora non completata
- if (riga.CodStatoLista == (int)statoLista.bozza)
- {
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.generata);
- answ = esitoOperazione.ok;
- }
- // se è solo iniziata permetto di riportarla a generata...
- else if (riga.CodStatoLista == (int)statoLista.iniziata)
- {
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.generata);
- answ = esitoOperazione.ok;
- }
- // se è già completata dà errore
- else
- {
- answ = esitoOperazione.errore_readOnly;
- }
- }
- // se la lista non esiste dai errore
- else
- {
- answ = esitoOperazione.errore;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// indica presa in carico di una lista di prelievo
- ///
- /// Codice company/sito
- /// codice della lista di prelievo
- /// cod operatore carrellista
- ///
- public esitoOperazione iniziaListaPrelievo(string CodCS, string CodLista, string CodSoggetto)
- {
- memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", CodLista));
- memLayer.ML.setSessionVal("CodListaAttiva", CodLista, true);
- // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
- esitoOperazione answ = esitoOperazione.errore;
-
- try
- {
- // la query recupera la lista in base al CodLista
- DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
- DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
-
- // se la lista esiste...
- if (tabella.Rows.Count > 0)
- {
- // se la lista è ancora non completata
- if (riga.CodStatoLista == (int)statoLista.generata)
- {
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.iniziata);
- answ = esitoOperazione.ok;
- }
- // se è già completata o iniziata dà errore
- else
- {
- answ = esitoOperazione.errore_readOnly;
- }
- }
- // se la lista non esiste dai errore
- else
- {
- answ = esitoOperazione.errore;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// indica come completata (da parte del magazziniere) una lista di prelievo
- ///
- /// Codice company/sito
- /// codice della lista di prelievo
- /// cod operatore carrellista
- /// IP del client
- ///
- public esitoOperazione completaListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp)
- {
- // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
- esitoOperazione answ = esitoOperazione.errore;
- try
- {
- // la query recupera la lista in base al CodLista
- DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
- DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
-
- // se la lista esiste...
- if (tabella.Rows.Count > 0)
- {
- // se la lista è ancora non completata
- if (riga.CodStatoLista == (int)statoLista.iniziata)
- {
- // controllo se ALMENO un UDC sia stsato prelevato
- int numUdcPrelevati = taRigheListePrelievo.getByCodListaPrelevate(CodLista).Rows.Count;
- if (numUdcPrelevati > 0)
- {
- // ricavo il codtipolista
- string codTipoListaAttuale = riga.CodTipoLista;
-
- //leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
- DS_magazzino.TipoListaPrelievoDataTable tabellaTipoLista = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale);
- DS_magazzino.TipoListaPrelievoRow rigaTipoLista = tabellaTipoLista[0];
-
- // leggo da righe lista prelievo il dato udc che mi serve
- DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
- DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
-
- // leggo il codice della cella...
- string codCellaDestAttuale = rigaTipoLista.CodCella;
- // lo trasformo x avere la cella di destinazione...
- int idxCellaTo = taCelle.getByCodCella(codCellaDestAttuale)[0].IdxCella;
- // sposto ("metto a terra") gli UDC
- foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
- {
- // ricavo il codice UDC...
- string _UDC = row.UDC;
- // sposto UDC
- spostaUDC(CodCS, _UDC, idxCellaTo, false, clientIp);
- // dopo aver spostato UDC sistemo eventuali Righe di Prelievo x lo stesso UDC pending...
- taRigheListePrelievo.stp_RLP_sbloccaNonPrelevate(CodLista, _UDC);
- }
- // libero le righe non prelevate...
- taRigheListePrelievo.stp_RLP_eliminaNonPrelevate(CodLista);
- // aggiorno stato lista
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.completata);
- answ = esitoOperazione.ok;
- memLayer.ML.emptySessionVal("CodListaAttiva");
- memLayer.ML.emptySessionVal("activeTask");
- }
- else //nessun UDC prelevato
- {
- answ = esitoOperazione.errore_noUdc;
- }
- }
- // se è già completata o NON iniziata dà errore
- else
- {
- answ = esitoOperazione.errore_readOnly;
- }
- }
- // se la lista non esiste dai errore
- else
- {
- answ = esitoOperazione.errore;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// Effettua lo scaricamento della lista di prelievo indicata, ovvero
- /// - toglie dalle posizioni di magazzino tutti gli UDC indicati come prelevati (liberando tali posizioni)
- /// - assegna tutti gli UDC prelevati alla cella indicata per il tipo di lista di prelievo interessata
- /// - elimina eventuali righe di prelievo della lista per UDC non effettivamente prelevate
- /// - chiude la lista di prelievo (completata = 1)
- ///
- /// Modifica vers 2.5: check trattamenti (ove attributo sia trovato...)
- ///
- /// Codice company/sito
- /// codice della lista di prelievo
- /// cod operatore carrellista
- /// IP del client
- /// Slot PL AS400 prescelto
- /// esito comando
- public esitoOperazione scaricaListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp, int SlotPL)
- {
- /*
- * Questa funzione serve ALLA FINE delle operazioni di prelievo, x chiudere la lista di prelievo
- * - controllo se la lista esiste, ed è ancora NON completata
- * - se risulta già completata errore xché è "readOnly" la lista essendo già completata (vedere l'enum in fondo al codice)
- * - se la lista è ok
- * - leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
- * - sposto TUTTI gli UDC delle righeListaPrelievo, da posizione attuale a posizione indicata da tipo lista
- * (quindi da codCella --> IdxCella --> spostamento
- *
- *
- * 2014.06.12: aggiunta x gestione PackList AS400
- * - verifico imballi, salvo su tab movimenti gli imballi eventuali da scaricare
- * - chiamo stored x copia dati pack list su AS400
- * - chiamo stored che richiamerà SSIS e quindi CL di as400
- *
- *
- * indico la lista come completata = 1 (true)
- * */
- // setup eventuali valori x rettifica
- bool fatto = false;
-
- esitoOperazione answ = esitoOperazione.errore;
- int trovate = 0;
- DS_magazzino.ElencoListePrelievoDataTable tabella;
- DS_magazzino.ElencoListePrelievoRow riga;
- try
- {
- tabella = taElencoListePrelievo.getByCodLista(CodLista);
- riga = tabella[0];
- trovate = tabella.Rows.Count;
-
- // se la lista esiste...
- if (trovate > 0)
- {
- // se la lista è completata
- if (riga.CodStatoLista == (int)statoLista.completata)
- {
- // ricavo il codtipolista
- string codTipoListaAttuale = riga.CodTipoLista;
-
- // leggo da tipoLista prelievo alcuni dati (es codcella di destinazione)
- DS_magazzino.TipoListaPrelievoDataTable tabellaTipoLista = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale);
- DS_magazzino.TipoListaPrelievoRow rigaTipoLista = tabellaTipoLista[0];
-
- // leggo da righe lista prelievo il dato udc che mi serve
- DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
- DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
-
- // leggo il codice della cella...
- string CodEvento = rigaTipoLista.CodEvento;
- // posizione che devono avere (uguale) tutti gli UDC
- int idxPosizUdcAll = 0;
- // posizione corrente dell'UDC
- int idxPosizUdcCorr = 0;
- // posizione di destinazione per UDC corrente
- int idxPosizUdcDest = 0;
- // cella di provenienza
- int idxCellaFrom = 0;
- // cella di destinazione
- int idxCellaTo = 0;
- /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- * ora controllo se la lista sia DAVVERO scaricabile, cioè
- * - destinatario IMPOSTATO
- * - TUTTE le righe hanno una posizione di destinazione valida,
- * OVVERO tutte le righe hanno nella tab trans posiz eventi una riga valida
- * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
- bool listaScaricabile = true;
- if (riga.Destinatario == "")
- {
- listaScaricabile = false;
- }
- else
- {
- foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
- {
- // ricavo il codice UDC...
- string UDC = row.UDC;
- // mi serve per posizione udc corrente
- DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
- // calcolo posizione destinazione da state machine...
- idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
- if (idxPosizUdcAll == 0)
- {
- idxPosizUdcAll = idxPosizUdcCorr;
- }
- idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(CodEvento, idxPosizUdcCorr);
- if (idxPosizUdcDest == 0 || idxPosizUdcAll != idxPosizUdcCorr)
- {
- listaScaricabile = false;
- }
- }
- }
- // SE la lista è scaricabile procedo...
- if (listaScaricabile)
- {
- // 2015.09.18: aggiunto controllo che NON ci siano UDC con NC
- if (taRigheListePrelievo.getUdcSenzaDelibPM(CodLista).Rows.Count == 0)
- {
- if (taRigheListePrelievo.getUdcConNC(CodLista).Rows.Count == 0)
- {
- if (taRigheListePrelievo.getDmtxUdcConNc(CodLista).Rows.Count == 0)
- {
- // scarico i vari UDC dal magazzino (come posizione corrente)
- foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
- {
- // ricavo il codice UDC...
- string UDC = row.UDC;
- // mi serve per posizione udc corrente
- DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
- // il secondo idx che mi serve
- idxCellaFrom = rigaUdcCorrente.IdxCella;
- // calcolo posizione destinazione da state machine...
- idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
- idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(CodEvento, idxPosizUdcCorr);
- // a questo punto mi calcolo se c'è una cella di destinazione associata
- try
- {
- idxCellaTo = MagClass.magazzino.taCelle.getByCodMag(CodCS, idxPosizUdcDest.ToString())[0].IdxCella;
- }
- catch
- {
- idxCellaTo = 0;
- }
- // sposto UDC, e così facendo genero movimenti batch x AS400
- fatto = scaricaUDC(UDC, idxPosizUdcDest, CodEvento, clientIp);
- // sposto nella PRIMA cella di destinazione associata l'UDC
- if (idxCellaTo > 0)
- {
- spostaUDC(CodCS, UDC, idxCellaTo, false, clientIp);
- }
- if (fatto)
- {
- // dopo aver scaricato UDC sistemo eventuali Righe di Prelievo x lo stesso pending...
- magazzino.taRigheListePrelievo.stp_RLP_sbloccaNonPrelevate(CodLista, UDC);
- }
- }
- // ora step finali x LDP
- try
- {
- // STEP 1: segna come scaricata la lista prelievo
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.scaricata);
- // STEP 2: chiamo esportazione verso MovMag AS x imballi + copiare in altra tabella (quella per AS...) i dati della packing
- taElencoListePrelievo.stp_LP_exportToAs400(CodLista, SlotPL, CodCS);
- // STEP 3: chiamo stored x eseguire SSIS che a sua volta richiama la CL di AS400 x importazione MovMag
- utils.obj.taAs400.stp_processaCodaMovimPackList();
- // restituisce ok
- answ = esitoOperazione.ok;
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in trasferimento dati LDP verso AS400: {0}", exc), tipoLog.EXCEPTION);
- }
- }
- else
- {
- answ = esitoOperazione.errore_DtmxNc;
- }
- }
- else
- {
- answ = esitoOperazione.errore_UdcNc;
- }
- }
- else
- {
- answ = esitoOperazione.errore_noDeliberPM;
- }
- }
- else
- {
- answ = esitoOperazione.errore_nonScaricabile;
- }
- }
- // se è già completata dà errore
- else
- {
- answ = esitoOperazione.errore_readOnly;
- }
- }
- // se la lista non esiste dai errore
- else
- {
- answ = esitoOperazione.errore;
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// resetta (riporta in bozza) una lista di prelievo, spostando gli UDC alla posizione standard precedente
- ///
- /// Codice company/sito
- /// codice della lista di prelievo
- /// cod operatore carrellista
- /// IP del client
- ///
- public esitoOperazione resetListaPrelievo(string CodCS, string CodLista, string CodSoggetto, string clientIp)
- {
- memLayer.ML.emptySessionVal("CodListaAttiva");
- memLayer.ML.emptySessionVal("activeTask");
- // da chiamare quando clicco e inizio lista prelievo .... vedi sopra
- esitoOperazione answ = esitoOperazione.errore;
- // posizione corrente dell'UDC
- int idxPosizUdcAll = 0; // posizione che devono avere (uguale) tutti gli UDC
- int idxPosizUdcCorr = 0;
- int IdxPosizioneTo = 0;
- int idxPosizUdcDest = 0;
- int idxCellaTo = 0;
- try
- {
- // la query recupera la lista in base al CodLista
- DS_magazzino.ElencoListePrelievoDataTable tabella = taElencoListePrelievo.getByCodLista(CodLista);
- DS_magazzino.ElencoListePrelievoRow riga = tabella[0];
-
- // se la lista esiste...
- if (tabella.Rows.Count > 0)
- {
- // ricontrollo che la lista sia completata
- if (riga.CodStatoLista >= (int)statoLista.completata)
- {
- // calcolo tipo lista di prelievo
- string codTipoListaAttuale = riga.CodTipoLista;
- // dal tipo lista determino l'evento
- string codEvento = taTipoListaPrelievo.getByCodTipoLista(codTipoListaAttuale)[0].CodEvento;
- // 2014.07.10 ATTENZIONE cablato evento reset come Pre --> Rst
- codEvento = codEvento.Replace("Pre", "Rst");
- // leggo da righe lista prelievo il dato udc che mi serve
- DS_magazzino.RigheListePrelievoDataTable tabellaRigheListaPrelievo = taRigheListePrelievo.getByCodListaPrelevate(CodLista);
- DS_magazzino.RigheListePrelievoRow rigaListaPrelievo = tabellaRigheListaPrelievo[0];
-
- /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- * ora controllo se la lista sia DAVVERO scaricabile, cioè
- * - destinatario IMPOSTATO
- * - TUTTE le righe hanno una posizione di destinazione valida,
- * OVVERO tutte le righe hanno nella tab trans posiz eventi una riga valida
- * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
- bool listaScaricabile = true;
- if (riga.Destinatario == "")
- {
- listaScaricabile = false;
- }
- else
- {
- foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
- {
- // ricavo il codice UDC...
- string UDC = row.UDC;
- //// mi serve per posizione udc corrente
- //DS_magazzino.PosizioneUdcCorrenteRow rigaUdcCorrente = taPosUdcCorr.getByUDC(UDC)[0];
- // calcolo posizione destinazione da state machine...
- idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(UDC)[0].IdxPosizione;
- if (idxPosizUdcAll == 0)
- {
- idxPosizUdcAll = idxPosizUdcCorr;
- }
- idxPosizUdcDest = StateMachine.SM.getIdxPostizioneTo(codEvento, idxPosizUdcCorr);
- if (idxPosizUdcDest == 0 || idxPosizUdcAll != idxPosizUdcCorr)
- {
- listaScaricabile = false;
- }
- }
- }
- // procedo SOLO se lista scaricabile...
- if (listaScaricabile)
- {
- // Modifica x gestione "blocco " da stato LDP: PRIMA passo a bozza...
- taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.bozza);
- // sposto ("metto a terra") gli UDC
- string _UDC = "";
- foreach (DS_magazzino.RigheListePrelievoRow row in tabellaRigheListaPrelievo.Rows)
- {
- // ricavo il codice UDC...
- _UDC = row.UDC;
- // posizione corrente
- idxPosizUdcCorr = taCartellini.getDetailsUdcByUdc(_UDC)[0].IdxPosizione;
- // calcolo posizione destinazione da state machine...
- try
- {
- IdxPosizioneTo = StateMachine.SM.taTTPE.getByEventoPosizione(codEvento, idxPosizUdcCorr)[0].IdxPosizioneTo;
- }
- catch (Exception exc)
- {
- IdxPosizioneTo = 0;
- logger.lg.scriviLog(string.Format(" | {1} | Errore in reset lista prelievo nel calcolo IdxPosizioneTo: {0}", exc, clientIp), tipoLog.EXCEPTION);
- }
- if (IdxPosizioneTo != 0)
- {
- // lo trasformo x avere la cella di destinazione...
- if (idxPosizUdcCorr < 0)
- {
- // se parto da cella negativa (consumato) calcolo destinazione da cella TO...
- idxCellaTo = taCelle.getFirstByPosizione(IdxPosizioneTo.ToString())[0].IdxCella;
- }
- else
- {
- try
- {
- // altrimenti uso la posizione corrente (NON faccio vero spostamento...
- idxCellaTo = taCelle.getFirstByPosizione(idxPosizUdcCorr.ToString())[0].IdxCella;
- }
- catch
- {
- // se parto da cella negativa (consumato) calcolo destinazione da cella TO...
- idxCellaTo = taCelle.getFirstByPosizione(IdxPosizioneTo.ToString())[0].IdxCella;
- }
- }
- // sposto UDC
- spostaUDC(CodCS, _UDC, idxCellaTo, false, clientIp);
- // 2014.07.09: modifica, per NON impostare da tab del magazzino con sposta fa update posizione esplicita
- taCartellini.updateIdxPosizione(_UDC, IdxPosizioneTo, CodSoggCurrUser);
- }
- }
- // indico le righe come NON prelevate...
- taRigheListePrelievo.stp_RLP_resetPrelevate(CodLista);
- //// aggiorno stato lista che torna a BOZZA
- //taElencoListePrelievo.updateStato(CodSoggetto, CodLista, (int)statoLista.bozza);
- answ = esitoOperazione.ok;
- logger.lg.scriviLog(string.Format(" | {0} | resettata lista di prelievo UDC {1} | utente {2} | tipo {2}", clientIp, CodLista, CodSoggetto), tipoLog.INFO);
- }
- else
- {
- // loggo che c'è anomalia
- answ = esitoOperazione.errore_readOnly;
- logger.lg.scriviLog(string.Format(" | {0} | Errore in reset lista prelievo: non è stato possibile resettare per la posizione di almeno un UDC", clientIp), tipoLog.EXCEPTION);
- }
- }
- // se è già completata o NON iniziata dà errore
- else
- {
- answ = esitoOperazione.errore_readOnly;
- }
- }
- // se la lista non esiste dai errore
- else
- {
- answ = esitoOperazione.errore;
- }
+ UDC = tabCartellini[0].UDC;
+ // lo associo!
+ taRapQual.stp_associaUDC(rqRow.ProgUDC, UDC);
}
catch (Exception e)
{
- logger.lg.scriviLog(string.Format(" | {1} | Errore in reset lista prelievo: {0}", e, clientIp), tipoLog.EXCEPTION);
+ logger.lg.scriviLog(string.Format(" | {3} | Non sono riuscito a creare associazione UDC / rapp qual: UDC creato: {0}, progRappQual: {1}, eccezione: {2}", UDC, rqRow.ProgUDC, e, clientIp), tipoLog.EXCEPTION);
}
- return answ;
- }
-
-
- ///
- /// Conferma che un dato UDC è stato prelevato per soddisfare la lista di prelievo ed aggiorna o aggiunge riga in RigheListePrelievo
- ///
- /// codice della lista di prelievo
- /// Codice UDC
- /// esito comando
- public esitoOperazione confermaUdcPrelevatoPerLista(string CodLista, string UDC)
- {
- esitoOperazione answ = esitoOperazione.errore;
-
- // verifico che i dati corrispondano con il metodo relativo (vedi sopra)
- bool datiUdcOk = verificaDatiUdc(CodLista, UDC);
-
- if (datiUdcOk)
- {
- // richiamo stored di upsert
- taRigheListePrelievo.upsertPrelevato(CodLista, UDC);
- // ...dò risposta positiva
- answ = esitoOperazione.ok;
-
- }
- else
- {
- // altrimenti dò errore mismatch e non proseguo
- return answ = esitoOperazione.errore_mismatch;
- }
-
- return answ;
- }
- ///
- /// annulla il prelievo di un UDC, aggiornando RigheListePrelievo (solo preventivato...)
- ///
- /// codice della lista di prelievo
- /// Codice UDC
- /// esito comando
- public esitoOperazione annullaUdcPrelevatoPerLista(string CodLista, string UDC)
- {
- esitoOperazione answ = esitoOperazione.errore;
-
- /*
- * Questa funzione va chiamata da web o da terminalino ogni volta che si fa un annullamento di avvenuto prelievo, ovvero il carrellista ha ANNULLATO un prelievo di un UDC associato ad una lista
- *
- * - in primis controllo: esiste questa riga di prelievo udc/lista?
- * - se i dati non corrispondono esco e mando falso --> vedere l'enum in fondo al codice ed
- * usare esitoOperazione.errore_mismatch
- * - se i dati corrispondono allora
- * - cerco riga e tolgo check come prelevato
- * - se tutto ok passo esito ok
- *
- * */
try
{
- // ricavo dati
- DS_magazzino.RigheListePrelievoDataTable tabella = taRigheListePrelievo.getByCodLista(CodLista);
- DS_magazzino.RigheListePrelievoRow riga = tabella[0];
-
- // se i dati esistono procedo - eseguo stored che setta non prelevato = false per la riga selezionata
- if (tabella.Rows.Count > 0)
- {
- taRigheListePrelievo.setAnnullaUdcPrelevato(CodLista, UDC);
- answ = esitoOperazione.ok;
- }
-
- else
- {
- answ = esitoOperazione.errore_mismatch;
- }
+ if (rqRow.BenesQual == "N")
+ {
+ // se non c'è benestare cambio posizione ad un altra cella, la prima (terra) del cod blocco MP - N.C.
+ int idxPosizTo = taCelle.getByCodMag(memLayer.ML.cdv("CodCS"), memLayer.ML.confReadString("CodMagMP_NA"))[0].IdxCella;
+ spostaUDC(memLayer.ML.cdv("CodCS"), UDC, idxPosizTo, true, clientIp);
+ }
}
- catch
- { }
- return answ;
+ catch (Exception e)
+ {
+ logger.lg.scriviLog(string.Format(" | {3} | Non sono riuscito a spostare UDC non conforme: UDC creato: {0}, progRappQual: {1}, eccezione: {2}", UDC, rqRow.ProgUDC, e, clientIp), tipoLog.EXCEPTION);
+ }
+ }
}
- ///
- /// Rigenera una Lista di prelievo togliendo gli UDC non ancora prelevati rimettendo in logica FIFO gli UDC "liberi" disponibili
- ///
- /// codice della lista di prelievo
- /// esito comando
- public esitoOperazione scambiaUdcPerLista(string CodLista)
+
+ // se devo stampare lancio stampa...
+ if (doPrint)
{
- esitoOperazione answ = esitoOperazione.errore;
-
- /*
- * Questa funzione va chiamata da web o da terminalino ogni volta che si fa una richiesta di cambio per un UDC già prelevato, ovvero un altro carrellista prelevato un UDC associato alla mia lista corrente - rigenera UDC da prelevare
- * */
- try
- {
- // ricavo dati
- DS_magazzino.ElencoListePrelievoRow riga = taElencoListePrelievo.getByCodLista(CodLista)[0];
- // svuoto PRIMA gli UDC non prelevati
- taRigheListePrelievo.stp_RigheListePrelievo_eliminaNonPrelevate(CodLista);
- // rigenero righe UDC da prelevare
- DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = taCartellini.getUdcUnusedOlder(CodLista);
- allocaRigheListaPrelievo(riga.QtaTot, CodLista, tabellaElencoCartellini);
- }
- catch
- { }
- return answ;
+ stampaUdcDaRappQualita(numRapQual, printerName);
}
- ///
- /// Aggiunge UN SOLO UDC in logica FIFO tra gli UDC "liberi" disponibili
- ///
- /// codice della lista di prelievo
- /// esito comando
- public esitoOperazione addUdcPerLista(string CodLista)
- {
- esitoOperazione answ = esitoOperazione.errore;
- try
- {
- // ricavo dati
- DS_magazzino.ElencoListePrelievoRow riga = taElencoListePrelievo.getByCodLista(CodLista)[0];
- // rigenero righe UDC da prelevare
- DS_magazzino.ElencoCartelliniDataTable tabellaElencoCartellini = new DS_magazzino.ElencoCartelliniDataTable();
- // aggiungo l'UDC + vecchio (se c'è)
- try
- {
- tabellaElencoCartellini.ImportRow(taCartellini.getUdcUnusedOlder(CodLista)[0]);
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(String.Format("Errore in aggiunta UDC a lista prelievo: {0}", e), tipoLog.EXCEPTION);
- }
- allocaRigheListaPrelievo(riga.QtaTot, CodLista, tabellaElencoCartellini);
- }
- catch
- { }
- return answ;
- }
- ///
- /// vero/falso che l'utent eha una lista di prelievo attiva
- ///
- public bool userHasActiveLP
- {
- get
- {
- bool answ = false;
- try
- {
- answ = (MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser).Rows.Count > 0);
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// codice della lista di prelievo attiva
- ///
- public string codListaAttivaUtente
- {
- get
- {
- string answ = "";
- try
- {
- answ = MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser)[0].CodLista;
- }
- catch
- { }
- return answ;
- }
- }
- ///
- ///
- ///
- ///
- ///
- public bool listaPrelevabile(string CodLista)
- {
- bool answ = false;
- try
- {
- answ = (MagClass.magazzino.taElencoListePrelievo.getByCodLista(CodLista).Select("CodStatoLista = 1").Length > 0); // filtro su stato = 1 (può esser presa in carico)
- }
- catch
- { }
- return answ;
- }
-
- #endregion
-
- #region area rapporti qualità
-
- ///
- /// Crea gli UDC da associare ai cartellini dei rapporti qualità deliberati, li associa e se richiesto lancia stampa
- ///
- /// identificativo rapp qualità
- /// true/false se stampare
- /// IP del client
- ///
- public bool creaUdcDaRappQualita(int numRapQual, string note, bool doPrint, string printerName, string clientIp)
- {
- bool answ = false;
- string CodStato = "";
- // ottengo elenco righe dei cartellini del rapp qualità indicato SENZA righe UDC
- DS_magazzino.RapQualDataTable tabRapQual = taRapQual.getByNumRapQualNoUdc(numRapQual);
- // per prima cosa verifico che ci sia il rapporto di qualità in esame e che abbia righe da associare ad UDC
- if (tabRapQual.Rows.Count > 0)
- {
- string UDC = "";
- foreach (DS_magazzino.RapQualRow rqRow in tabRapQual)
- {
- // se non ha già un UDC... e se NON E' stato già scaricato...
- if (rqRow.UDC == "" && rqRow.LegaScaric.ToUpper() == "N")
- {
- answ = true;
- // controllo se sia con benestare, se "N" imposto con stato Non accettata (da web.config) altrimenti con stato MP ok...
- if (rqRow.BenesQual == "N")
- {
- CodStato = memLayer.ML.confReadString("CodStatoMP-NA");
- }
- else
- {
- CodStato = memLayer.ML.confReadString("CodStatoMP");
- }
- // per ogni riga creo un UDC
- DS_Applicazione.ElencoCartelliniDataTable tabCartellini = DataProxy.obj.taCartellini.stp_insNewFull(memLayer.ML.cdv("CodCS"), memLayer.ML.confReadString("BilanciaMP"), string.Format("{0:yy}", DateTime.Now), rqRow.CodFor, rqRow.CodLega, "", "", "", "", DateTime.Now, 0, memLayer.ML.cdv("CodImballoMP"), CodSoggCurrUser, 0, memLayer.ML.cdvi("IdxPosizMP"), "M", "UDC_MP", rqRow.Qta, Convert.ToDouble(rqRow.Qta), 1, CodStato, rqRow.ProgUDC, false, note); // UDC_MP HARD CODED!!!
- try
- {
- UDC = tabCartellini[0].UDC;
- // lo associo!
- taRapQual.stp_associaUDC(rqRow.ProgUDC, UDC);
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {3} | Non sono riuscito a creare associazione UDC / rapp qual: UDC creato: {0}, progRappQual: {1}, eccezione: {2}", UDC, rqRow.ProgUDC, e, clientIp), tipoLog.EXCEPTION);
- }
- try
- {
- if (rqRow.BenesQual == "N")
- {
- // se non c'è benestare cambio posizione ad un altra cella, la prima (terra) del cod blocco MP - N.C.
- int idxPosizTo = taCelle.getByCodMag(memLayer.ML.cdv("CodCS"), memLayer.ML.confReadString("CodMagMP_NA"))[0].IdxCella;
- spostaUDC(memLayer.ML.cdv("CodCS"), UDC, idxPosizTo, true, clientIp);
- }
- }
- catch (Exception e)
- {
- logger.lg.scriviLog(string.Format(" | {3} | Non sono riuscito a spostare UDC non conforme: UDC creato: {0}, progRappQual: {1}, eccezione: {2}", UDC, rqRow.ProgUDC, e, clientIp), tipoLog.EXCEPTION);
- }
- }
- }
-
- // se devo stampare lancio stampa...
- if (doPrint)
- {
- stampaUdcDaRappQualita(numRapQual, printerName);
- }
- }
- return answ;
- }
- ///
- /// aggiorna le note di un RDQ
- ///
- ///
- ///
- public bool updateNoteRDQ(int numRapQual, string note)
- {
- bool answ = false;
- try
- {
- DataProxy.obj.taRQN.stp_UDC_updateNoteByRQ(numRapQual, note, CodSoggCurrUser);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// effettua la (ri)stampa di TUTTI gli UDC dato un rapporto di qualità
- ///
- /// identificativo rapp qualità
- ///
- public bool stampaUdcDaRappQualita(int numRapQual, string printerName)
- {
- bool answ = false;
- // ottengo elenco righe dei cartellini del rapp qualità indicato SENZA righe UDC
- DS_magazzino.RapQualDataTable tabRapQual = taRapQual.getByNumRapQual(numRapQual);
- // per prima cosa verifico che ci sia il rapporto di qualità in esame e che abbia righe da associare ad UDC
- if (tabRapQual.Rows.Count > 0)
- {
- answ = true;
- foreach (DS_magazzino.RapQualRow rqRow in tabRapQual)
- {
- answ = reportPrinter.obj.stampaCartellino(tipoCartellino.cartMP, rqRow.UDC, printerName);
- }
- }
- return answ;
- }
-
-
- #endregion
-
- #region area utility
-
- ///
- /// Decodifica il tipo barcode acquisito sino L5
- /// L1: comandi/matricole/DT e BCD
- /// L2: Particolari/Imballi
- /// L3: UDC
- /// L4: AL
- /// L5: DataMatrix
- ///
- public static tipoCodiceBarcode tipoBCode_L5(string valore)
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(valore);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- string preDT = memLayer.ML.AppConf["prefDateTime"];
- string preBCD = memLayer.ML.AppConf["prefBCode"];
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- string statoDtx = "";
- string formatoDtx = "";
- // cerco di decodificare il Datamatrix...
- try
- {
- DS_DataMatrix.stp_verificaDtxRow rowVerifica = DataMatrix.mgr.taVerifica.GetData(valore)[0];
- statoDtx = rowVerifica.StatoDtx;
- formatoDtx = rowVerifica.FormatoDtmx;
- }
- catch
- { }
- if (valore.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if (valore.StartsWith(preBCD))
- {
- answ = tipoCodiceBarcode.BarCodeCMD;
- }
- else if (valore.StartsWith(preDT))
- {
- // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
- if (valore.Length > 12)
- {
- answ = tipoCodiceBarcode.DateTimeLine;
- }
- else
- {
- answ = tipoCodiceBarcode.DateTime;
- }
- }
- // cerco se c'è assieme logico
- else if (MagClass.magazzino.checkAL(valore))
- {
- answ = tipoCodiceBarcode.AL;
- }
- else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (((statoDtx == "OK") || (statoDtx == "KO")) && formatoDtx != "")
- {
- answ = tipoCodiceBarcode.DataMatrixTrovato;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else if (valore.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if ((statoDtx == "ND") && DataMatrix.mgr.maybeDatamatrix(valore)) // controllo se sia un POSSIBILE datamatrix poiché riesco a ricavare un partnumber noto...
- {
- answ = tipoCodiceBarcode.DataMatrixDecodificato;
- }
- else if (magazzino.taET.getByTratt(valore).Rows.Count > 0)
- {
- answ = tipoCodiceBarcode.TT;
- }
- else
- {
- try
- {
- // cerco tra UDC...
- trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
-
- ///
- /// Decodifica il tipo barcode acquisito sino L4
- /// L1: comandi/matricole/DT e BCD
- /// L2: Particolari/Imballi
- /// L3: UDC
- /// L4: AL
- ///
- public static tipoCodiceBarcode tipoBCode_L4(string valore)
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(valore);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- string preDT = memLayer.ML.AppConf["prefDateTime"];
- string preBCD = memLayer.ML.AppConf["prefBCode"];
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (valore.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if (valore.StartsWith(preBCD))
- {
- answ = tipoCodiceBarcode.BarCodeCMD;
- }
- else if (valore.StartsWith(preDT))
- {
- // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
- if (valore.Length > 12)
- {
- answ = tipoCodiceBarcode.DateTimeLine;
- }
- else
- {
- answ = tipoCodiceBarcode.DateTime;
- }
- }
- // cerco se c'è assieme logico
- else if (MagClass.magazzino.checkAL(valore))
- {
- answ = tipoCodiceBarcode.AL;
- }
- else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else if (valore.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (magazzino.taET.getByTratt(valore).Rows.Count > 0)
- {
- answ = tipoCodiceBarcode.TT;
- }
- else
- {
- try
- {
- // cerco tra UDC...
- trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
-
- ///
- /// Decodifica il tipo barcode acquisito
- /// checkL3 = verifica i livelli sino L3
- /// L1: comandi/matricole/DT e BCD
- /// L2: Particolari/Imballi
- /// L3: UDC
- ///
- public static tipoCodiceBarcode tipoBCode_L3(string valore)
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(valore);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- string preDT = memLayer.ML.AppConf["prefDateTime"];
- string preBCD = memLayer.ML.AppConf["prefBCode"];
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (valore.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if (valore.StartsWith(preBCD))
- {
- answ = tipoCodiceBarcode.BarCodeCMD;
- }
- else if (valore.StartsWith(preDT))
- {
- // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
- if (valore.Length > 12)
- {
- answ = tipoCodiceBarcode.DateTimeLine;
- }
- else
- {
- answ = tipoCodiceBarcode.DateTime;
- }
- }
- else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else if (valore.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra UDC...
- trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
-
- #endregion
-
- #region area utenti
-
- ///
- /// recupera CognomeNome da CodSogg
- ///
- ///
- ///
- public string cognomeNomeFromCodSogg(object CodSogg)
- {
- string answ = "";
- try
- {
- DS_Applicazione.AnagOperatoriRow riga = DataProxy.obj.taAnagOperatore.getByCodSoggetto(CodSogg.ToString())[0];
- answ = string.Format("{0} {1}", riga.Cognome, riga.Nome);
- }
- catch
- { }
- return answ;
- }
-
- #endregion
-
- #endregion
-
+ }
+ return answ;
}
+ ///
+ /// aggiorna le note di un RDQ
+ ///
+ ///
+ ///
+ public bool updateNoteRDQ(int numRapQual, string note)
+ {
+ bool answ = false;
+ try
+ {
+ DataProxy.obj.taRQN.stp_UDC_updateNoteByRQ(numRapQual, note, CodSoggCurrUser);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// effettua la (ri)stampa di TUTTI gli UDC dato un rapporto di qualità
+ ///
+ /// identificativo rapp qualità
+ ///
+ public bool stampaUdcDaRappQualita(int numRapQual, string printerName)
+ {
+ bool answ = false;
+ // ottengo elenco righe dei cartellini del rapp qualità indicato SENZA righe UDC
+ DS_magazzino.RapQualDataTable tabRapQual = taRapQual.getByNumRapQual(numRapQual);
+ // per prima cosa verifico che ci sia il rapporto di qualità in esame e che abbia righe da associare ad UDC
+ if (tabRapQual.Rows.Count > 0)
+ {
+ answ = true;
+ foreach (DS_magazzino.RapQualRow rqRow in tabRapQual)
+ {
+ answ = reportPrinter.obj.stampaCartellino(tipoCartellino.cartMP, rqRow.UDC, printerName);
+ }
+ }
+ return answ;
+ }
+
+
+ #endregion
+
+ #region area utility
+
+ ///
+ /// Decodifica il tipo barcode acquisito sino L5
+ /// L1: comandi/matricole/DT e BCD
+ /// L2: Particolari/Imballi
+ /// L3: UDC
+ /// L4: AL
+ /// L5: DataMatrix
+ ///
+ public static tipoCodiceBarcode tipoBCode_L5(string valore)
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(valore);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ string preDT = memLayer.ML.AppConf["prefDateTime"];
+ string preBCD = memLayer.ML.AppConf["prefBCode"];
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ string statoDtx = "";
+ string formatoDtx = "";
+ // cerco di decodificare il Datamatrix...
+ try
+ {
+ DS_DataMatrix.stp_verificaDtxRow rowVerifica = DataMatrix.mgr.taVerifica.GetData(valore)[0];
+ statoDtx = rowVerifica.StatoDtx;
+ formatoDtx = rowVerifica.FormatoDtmx;
+ }
+ catch
+ { }
+ if (valore.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if (valore.StartsWith(preBCD))
+ {
+ answ = tipoCodiceBarcode.BarCodeCMD;
+ }
+ else if (valore.StartsWith(preDT))
+ {
+ // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
+ if (valore.Length > 12)
+ {
+ answ = tipoCodiceBarcode.DateTimeLine;
+ }
+ else
+ {
+ answ = tipoCodiceBarcode.DateTime;
+ }
+ }
+ // cerco se c'è assieme logico
+ else if (MagClass.magazzino.checkAL(valore))
+ {
+ answ = tipoCodiceBarcode.AL;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ else if (((statoDtx == "OK") || (statoDtx == "KO")) && formatoDtx != "")
+ {
+ answ = tipoCodiceBarcode.DataMatrixTrovato;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else if (valore.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if ((statoDtx == "ND") && DataMatrix.mgr.maybeDatamatrix(valore)) // controllo se sia un POSSIBILE datamatrix poiché riesco a ricavare un partnumber noto...
+ {
+ answ = tipoCodiceBarcode.DataMatrixDecodificato;
+ }
+ else if (magazzino.taET.getByTratt(valore).Rows.Count > 0)
+ {
+ answ = tipoCodiceBarcode.TT;
+ }
+ else
+ {
+ try
+ {
+ // cerco tra UDC...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// Decodifica il tipo barcode acquisito sino L4
+ /// L1: comandi/matricole/DT e BCD
+ /// L2: Particolari/Imballi
+ /// L3: UDC
+ /// L4: AL
+ ///
+ public static tipoCodiceBarcode tipoBCode_L4(string valore)
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(valore);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ string preDT = memLayer.ML.AppConf["prefDateTime"];
+ string preBCD = memLayer.ML.AppConf["prefBCode"];
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (valore.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if (valore.StartsWith(preBCD))
+ {
+ answ = tipoCodiceBarcode.BarCodeCMD;
+ }
+ else if (valore.StartsWith(preDT))
+ {
+ // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
+ if (valore.Length > 12)
+ {
+ answ = tipoCodiceBarcode.DateTimeLine;
+ }
+ else
+ {
+ answ = tipoCodiceBarcode.DateTime;
+ }
+ }
+ // cerco se c'è assieme logico
+ else if (MagClass.magazzino.checkAL(valore))
+ {
+ answ = tipoCodiceBarcode.AL;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else if (valore.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (magazzino.taET.getByTratt(valore).Rows.Count > 0)
+ {
+ answ = tipoCodiceBarcode.TT;
+ }
+ else
+ {
+ try
+ {
+ // cerco tra UDC...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// Decodifica il tipo barcode acquisito
+ /// checkL3 = verifica i livelli sino L3
+ /// L1: comandi/matricole/DT e BCD
+ /// L2: Particolari/Imballi
+ /// L3: UDC
+ ///
+ public static tipoCodiceBarcode tipoBCode_L3(string valore)
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(valore);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ string preDT = memLayer.ML.AppConf["prefDateTime"];
+ string preBCD = memLayer.ML.AppConf["prefBCode"];
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (valore.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if (valore.StartsWith(preBCD))
+ {
+ answ = tipoCodiceBarcode.BarCodeCMD;
+ }
+ else if (valore.StartsWith(preDT))
+ {
+ // se lungh = 2+10 (DT+yyMMddHHmm) è SOLO datetime, altrimenti è DateTimeLine
+ if (valore.Length > 12)
+ {
+ answ = tipoCodiceBarcode.DateTimeLine;
+ }
+ else
+ {
+ answ = tipoCodiceBarcode.DateTime;
+ }
+ }
+ else if ((TermClass.Ter.riconosciBarcode(valore) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(valore).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else if (valore.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(valore, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra UDC...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(valore).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+
+ #endregion
+
+ #region area utenti
+
+ ///
+ /// recupera CognomeNome da CodSogg
+ ///
+ ///
+ ///
+ public string cognomeNomeFromCodSogg(object CodSogg)
+ {
+ string answ = "";
+ try
+ {
+ DS_Applicazione.AnagOperatoriRow riga = DataProxy.obj.taAnagOperatore.getByCodSoggetto(CodSogg.ToString())[0];
+ answ = string.Format("{0} {1}", riga.Cognome, riga.Nome);
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ #endregion
+
+ #endregion
+
+ }
}
public enum esitoOperazione
{
- ok // tutto ok, come true
+ ok // tutto ok, come true
, errore // non è andata errore generico
, errore_mismatch // errore x mancanza corrispondenza tra dati (particolare-esponente-figura di lista ed UDC ad esempio)
, errore_readOnly // errore xché il dato è read only o bloccato (es lista di prelievo già completata NON posso riprenderla in carico)
@@ -3398,33 +3398,33 @@ public enum esitoOperazione
public enum statoLista
{
- bozza = 0,
- generata,
- iniziata,
- completata,
- scaricata
+ bozza = 0,
+ generata,
+ iniziata,
+ completata,
+ scaricata
}
///
/// esito verifica NC su UDC
///
public enum checkUdcNc
{
- ///
- /// NESSUNA NC
- ///
- NoNc,
- ///
- /// controllo disabilitato/non bloccate, NC NON presenti
- ///
- ChkDis_NoNc,
- ///
- /// controllo disabilitato/non bloccate, NC presenti
- ///
- ChkDis_HasNc,
- ///
- /// ci sono NC, bloccante
- ///
- HasNc
+ ///
+ /// NESSUNA NC
+ ///
+ NoNc,
+ ///
+ /// controllo disabilitato/non bloccate, NC NON presenti
+ ///
+ ChkDis_NoNc,
+ ///
+ /// controllo disabilitato/non bloccate, NC presenti
+ ///
+ ChkDis_HasNc,
+ ///
+ /// ci sono NC, bloccante
+ ///
+ HasNc
}
///
@@ -3432,28 +3432,28 @@ public enum checkUdcNc
///
public enum tipoAL
{
- ///
- /// non definito
- ///
- ND,
- ///
- /// Assieme RX
- ///
- AL_RX,
- ///
- /// Assieme RX Datamatrix
- ///
- AL_RxDt,
- ///
- /// Assieme RX NON Datamatrix
- ///
- AL_RxNt,
- ///
- /// Assieme TT Datamatrix
- ///
- AL_TT,
- ///
- /// Assieme TT NON Datamatrix
- ///
- AL_LI
+ ///
+ /// non definito
+ ///
+ ND,
+ ///
+ /// Assieme RX
+ ///
+ AL_RX,
+ ///
+ /// Assieme RX Datamatrix
+ ///
+ AL_RxDt,
+ ///
+ /// Assieme RX NON Datamatrix
+ ///
+ AL_RxNt,
+ ///
+ /// Assieme TT Datamatrix
+ ///
+ AL_TT,
+ ///
+ /// Assieme TT NON Datamatrix
+ ///
+ AL_LI
}
\ No newline at end of file
diff --git a/GMW_data/Odette.cs b/GMW_data/Odette.cs
index e18ece56..c488c5af 100644
--- a/GMW_data/Odette.cs
+++ b/GMW_data/Odette.cs
@@ -4,118 +4,122 @@ using System;
namespace GMW_data
{
+ ///
+ /// fa da proxy singleton x gli oggetti legati ai cartellini ODETTE
+ ///
+ public class Odette
+ {
///
- /// fa da proxy singleton x gli oggetti legati ai cartellini ODETTE
+ /// Oggetto locale gestione classe datamatrix...
///
- public class Odette
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
+ #region area table adapters
+
+ public DS_OdetteTableAdapters.OdetteTableAdapter taOdette;
+ public DS_OdetteTableAdapters.BORI202JTableAdapter taBORI;
+ public DS_OdetteTableAdapters.stp_OdetteStatoCreateTableAdapter taOdCreate;
+
+ ///
+ /// init dei table adapters
+ ///
+ protected void initTA()
{
- #region area table adapters
+ taOdette = new GMW_data.DS_OdetteTableAdapters.OdetteTableAdapter();
+ taBORI = new GMW_data.DS_OdetteTableAdapters.BORI202JTableAdapter();
+ taOdCreate = new GMW_data.DS_OdetteTableAdapters.stp_OdetteStatoCreateTableAdapter();
+ }
+ ///
+ /// effettua setup dei connection strings da web.config delal singola applicazione
+ ///
+ protected virtual void setupConnectionStringBase()
+ {
+ string connString = memLayer.ML.confReadString("GMWConnectionString");
+ // connections strings del db
+ taOdette.Connection.ConnectionString = connString;
+ taBORI.Connection.ConnectionString = connString;
+ taOdCreate.Connection.ConnectionString = connString;
+ }
+ #endregion
- public DS_OdetteTableAdapters.OdetteTableAdapter taOdette;
- public DS_OdetteTableAdapters.BORI202JTableAdapter taBORI;
- public DS_OdetteTableAdapters.stp_OdetteStatoCreateTableAdapter taOdCreate;
+ protected Odette()
+ {
+ initTA();
+ setupConnectionStringBase();
+ }
- ///
- /// init dei table adapters
- ///
- protected void initTA()
- {
- taOdette = new GMW_data.DS_OdetteTableAdapters.OdetteTableAdapter();
- taBORI = new GMW_data.DS_OdetteTableAdapters.BORI202JTableAdapter();
- taOdCreate = new GMW_data.DS_OdetteTableAdapters.stp_OdetteStatoCreateTableAdapter();
- }
- ///
- /// effettua setup dei connection strings da web.config delal singola applicazione
- ///
- protected virtual void setupConnectionStringBase()
- {
- string connString = memLayer.ML.confReadString("GMWConnectionString");
- // connections strings del db
- taOdette.Connection.ConnectionString = connString;
- taBORI.Connection.ConnectionString = connString;
- taOdCreate.Connection.ConnectionString = connString;
- }
- #endregion
+ #region area protected
- protected Odette()
- {
- initTA();
- setupConnectionStringBase();
- }
-
- #region area protected
-
- ///
- /// carica le label di lingua su un etichetta odette (che deve già esistere)
- ///
- ///
- ///
- ///
- protected bool caricaEtichetteLinguaPerOdette(string UDC, string lingua)
- {
- bool answ = false;
- // controllo se etichetta odette esiste...
- if (taOdette.getByUdc(UDC).Rows.Count > 0)
- {
- // carico le mie labels tradotte...
- string Campo1_1 = traduci("Campo1_1", lingua);
- string Campo2_1 = traduci("Campo2_1", lingua);
- string Campo3_1 = traduci("Campo3_1", lingua);
- string Campo4_1 = traduci("Campo4_1", lingua);
- string Campo5_1 = traduci("Campo5_1", lingua);
- string Campo6_1 = traduci("Campo6_1", lingua);
- string Campo7_1 = traduci("Campo7_1", lingua);
- string Campo8_1 = traduci("Campo8_1", lingua);
- string Campo9_1 = traduci("Campo9_1", lingua);
- string Campo10_1 = traduci("Campo10_1", lingua);
- string Campo11_1_1 = traduci("Campo11_1_1", lingua);
- string Campo11_2_1 = traduci("Campo11_2_1", lingua);
- string Campo12_1 = traduci("Campo12_1", lingua);
- string Campo13_1 = traduci("Campo13_1", lingua);
- string Campo14_1 = traduci("Campo14_1", lingua);
- string Campo15_1 = traduci("Campo15_1", lingua);
- string Campo16_1 = traduci("Campo16_1", lingua);
- // effettuo update!
- taOdette.updateLingua(UDC, Campo1_1, Campo2_1, Campo3_1, Campo4_1, Campo5_1, Campo6_1, Campo7_1, Campo8_1, Campo9_1, Campo10_1, Campo11_1_1, Campo11_2_1, Campo12_1, Campo13_1, Campo14_1, Campo15_1, Campo16_1);
- }
- else
- {
- logger.lg.scriviLog(string.Format("Attenzione! etichetta odette non trovata per l'UDC {0}", UDC), tipoLog.ERROR);
- }
- return answ;
- }
- ///
- /// verifica una etichetta odette e salva in db il valore di check x consistenza dei dati
- ///
- ///
- ///
- protected bool updateStatoOdette(string UDC)
- {
- bool answ = false;
- try
- {
- // effettuo verifiche sulla riga odette...
- // !!!FARE!!!
- answ = true;
- taOdette.setStato(UDC, answ);
- }
- catch
- { }
- return answ;
- }
- ///
- /// carica i dati per l'etichetta Odette provenienti dalla bolla indicata
- ///
- ///
- ///
- ///
- /// codice bolla
- /// data bolla formato YYYYMMDD
- ///
- ///
- protected bool caricaDatiBollaEtichettaOdette(string UDC, string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
- {
- // versione vecchia: ora faccio tutto con stored!
+ ///
+ /// carica le label di lingua su un etichetta odette (che deve già esistere)
+ ///
+ ///
+ ///
+ ///
+ protected bool caricaEtichetteLinguaPerOdette(string UDC, string lingua)
+ {
+ bool answ = false;
+ // controllo se etichetta odette esiste...
+ if (taOdette.getByUdc(UDC).Rows.Count > 0)
+ {
+ // carico le mie labels tradotte...
+ string Campo1_1 = traduci("Campo1_1", lingua);
+ string Campo2_1 = traduci("Campo2_1", lingua);
+ string Campo3_1 = traduci("Campo3_1", lingua);
+ string Campo4_1 = traduci("Campo4_1", lingua);
+ string Campo5_1 = traduci("Campo5_1", lingua);
+ string Campo6_1 = traduci("Campo6_1", lingua);
+ string Campo7_1 = traduci("Campo7_1", lingua);
+ string Campo8_1 = traduci("Campo8_1", lingua);
+ string Campo9_1 = traduci("Campo9_1", lingua);
+ string Campo10_1 = traduci("Campo10_1", lingua);
+ string Campo11_1_1 = traduci("Campo11_1_1", lingua);
+ string Campo11_2_1 = traduci("Campo11_2_1", lingua);
+ string Campo12_1 = traduci("Campo12_1", lingua);
+ string Campo13_1 = traduci("Campo13_1", lingua);
+ string Campo14_1 = traduci("Campo14_1", lingua);
+ string Campo15_1 = traduci("Campo15_1", lingua);
+ string Campo16_1 = traduci("Campo16_1", lingua);
+ // effettuo update!
+ taOdette.updateLingua(UDC, Campo1_1, Campo2_1, Campo3_1, Campo4_1, Campo5_1, Campo6_1, Campo7_1, Campo8_1, Campo9_1, Campo10_1, Campo11_1_1, Campo11_2_1, Campo12_1, Campo13_1, Campo14_1, Campo15_1, Campo16_1);
+ }
+ else
+ {
+ logger.lg.scriviLog(string.Format("Attenzione! etichetta odette non trovata per l'UDC {0}", UDC), tipoLog.ERROR);
+ }
+ return answ;
+ }
+ ///
+ /// verifica una etichetta odette e salva in db il valore di check x consistenza dei dati
+ ///
+ ///
+ ///
+ protected bool updateStatoOdette(string UDC)
+ {
+ bool answ = false;
+ try
+ {
+ // effettuo verifiche sulla riga odette...
+ // !!!FARE!!!
+ answ = true;
+ taOdette.setStato(UDC, answ);
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// carica i dati per l'etichetta Odette provenienti dalla bolla indicata
+ ///
+ ///
+ ///
+ ///
+ /// codice bolla
+ /// data bolla formato YYYYMMDD
+ ///
+ ///
+ protected bool caricaDatiBollaEtichettaOdette(string UDC, string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
+ {
+ // versione vecchia: ora faccio tutto con stored!
#if false
bool answ = false;
string ragSocCli = "";
@@ -371,343 +375,343 @@ namespace GMW_data
}
}
#endif
- bool answ = false;
- try
- {
- taOdette.caricaDatiBollaEtichettaOdette(memLayer.ML.cdv("CodCS"), UDC, numBolla.ToString(), dataBolla.ToString(), RaggMag, GrpBolla, particolare);
- answ = true;
- }
- catch
- {
- answ = false;
- }
- return answ;
- }
-
- #endregion
-
- #region area public
-
- ///
- /// singleton
- ///
- public static Odette mgr = new Odette();
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- ///
- public string traduci(string lemma, string lingua)
- {
- return user_std.UtSn.Traduci(lemma, lingua);
- }
-
- ///
- /// verifica l'esistenza di una bolla dato il suo codice + data
- ///
- /// cod raggr magazzino
- /// gruppo bolla
- /// codice bolla NUMERICO
- /// data bolla formato numerico YYYYMMDD
- /// codice particolare
- ///
- public bool checkCodBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
- {
- bool answ = false;
- int righeBolla = 0;
- // controllo che la bolla esista...
- try
- {
- // provo a caricarle con stored...
- taBORI.caricaDatiBolla(RaggMag, GrpBolla, numBolla.ToString(), dataBolla.ToString(), particolare);
- // rileggo se presenti...
- righeBolla = taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Rows.Count;
- answ = (righeBolla >= 1);
- }
- catch(Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in checkCodBolla:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- // controllo che la bolla non sia già associata... ovvero SENZA NESSUNA etichetta odette associata x quel particolare...
- if (answ)
- {
- // controllo se trovo odette associate a tale bolla...
- answ = (taOdette.getByBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare).Rows.Count == 0);
- }
- return answ;
- }
- ///
- /// conteggia il num di colli x una data bolla
- ///
- /// cod raggr magazzino
- /// gruppo bolla
- /// codice bolla NUMERICO
- /// data bolla formato numerico YYYYMMDD
- /// codice particolare
- ///
- public int totColliBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
- {
- int answ = 0;
- try
- {
- // calcolo il totale dei pezzi: ogni riga contiene il totale colli della bolla...
- //answ = (int)taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare)[0].NRC1B;
- answ = Convert.ToInt32(taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Compute("SUM(NRC1B)", ""));
- }
- catch
- { }
- return answ;
- }
- ///
- /// conteggia il num di pezzi x una data bolla
- ///
- /// cod raggr magazzino
- /// gruppo bolla
- /// codice bolla NUMERICO
- /// data bolla formato numerico YYYYMMDD
- /// codice particolare
- ///
- public int totPezziBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
- {
- int answ = 0;
- try
- {
- // rileggo se presenti...
- answ = Convert.ToInt32(taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Compute("SUM(QTCNS)", ""));
- //answ = (int)taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare)[0].QTCNS;
- }
- catch
- { }
- return answ;
- }
-
- ///
- /// crea tutte le righe encessarie alal stampa dei cartellini Odette dati lista di prelievo, bolla da associare
- ///
- /// codice lista di prelievo
- /// cod raggr magazzino
- /// gruppo bolla
- /// codice bolla NUMERICO
- /// data bolla formato numerico YYYYMMDD
- /// codice particolare
- /// IT/EN/...
- /// in caso di errore e ritorno false, salva in sessione il messaggio di errore relativo in errCreazOdette
- public bool creaOdetteByBollaPackList(string CodLista, string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare, string lingua)
- {
- bool answ = false;
- string errCreazOdette = "";
- int totUdc = 0;
- int totPz = 0;
- int udcOk = 0;
- DS_magazzino.RigheListePrelievoDataTable ElencoUdc = new DS_magazzino.RigheListePrelievoDataTable();
- // conto totale etichette da creare
- try
- {
- ElencoUdc = MagClass.magazzino.taRigheListePrelievo.getByCodLista(CodLista);
- totUdc = ElencoUdc.Rows.Count;
- totPz = (int)MagClass.magazzino.taElencoListePrelievo.getByCodLista(CodLista)[0].Prelevato;
- }
- catch
- {
- errCreazOdette = string.Format("Errore: non ci sono UDC da creare per la PackList {0}", CodLista);
- logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
- }
- // in primis comunque verifico che la bolla ci sia altrimenti non procedo (anche se avrebbe già dovuto controllare...)
- if (checkCodBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) && totUdc > 0)
- {
- // controllo se il totale colli corrisponde al totale UDC..
- if (totColliBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) == totUdc || true) // controllo disattivato 2013.03.22 perché i colli riga sono i colli totali bolla
- {
- // controllo se il totale pezzi corrisponde al totale qta...
- if (totPezziBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) == totPz)
- {
- // leggo elenco UDC da packing list
- foreach (DS_magazzino.RigheListePrelievoRow rigaUdc in ElencoUdc)
- {
- // per ogni UDC creo una riga
- taOdette.upsertUdc(rigaUdc.UDC, memLayer.ML.cdv("CodCS"), numBolla.ToString(), dataBolla.ToString(), RaggMag, GrpBolla, particolare, CodLista, memLayer.ML.confReadString("indStabFrom"), rigaUdc.Qta.ToString());
- udcOk++;
- // per ogni riga inserisco traduzione nella lingua richiesta
- caricaEtichetteLinguaPerOdette(rigaUdc.UDC, lingua);
- // vado a caricare i dati dalla tab dei dati bolle
- caricaDatiBollaEtichettaOdette(rigaUdc.UDC, RaggMag, GrpBolla, numBolla, dataBolla, particolare);
- // effettuo check della riga odette e determino se sia conforme
- updateStatoOdette(rigaUdc.UDC);
- }
- }
- else
- {
- errCreazOdette = string.Format("Errore assegnazione bolle/odette, il num di pezzi non corrisponde: num bolla {0} del {1}, lista prelievo {2}", numBolla, dataBolla, CodLista);
- logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
- }
- }
- else
- {
- errCreazOdette = string.Format("Errore assegnazione bolle/odette, il num di colli non corrisponde: num bolla {0} del {1}, lista prelievo {2}", numBolla, dataBolla, CodLista);
- logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
- }
- }
- else
- {
- errCreazOdette = string.Format("Tentativo di generazione etichette odette da bolla inesistente/già impiegata: codice {0} del {1}", numBolla, dataBolla);
- logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
- }
- // controllo se tutte le etichette sono sstate create
- if (totUdc == udcOk)
- {
- answ = true;
- }
- memLayer.ML.setSessionVal("errCreazOdette", errCreazOdette);
- return answ;
- }
- ///
- /// Stampa tutte le etichette odette di una lista di prelievo
- ///
- ///
- ///
- ///
- public bool stampaOdettePackingList(string CodLista, string printerName)
- {
- bool answ = false;
- int totOdette = 0;
- DS_Odette.OdetteDataTable ElencoOdette = new DS_Odette.OdetteDataTable();
- // conto totale etichette Odette con StatusOK=1 corrispondenti a lista prelievo
- try
- {
- ElencoOdette = taOdette.getByCodLista(CodLista);
- totOdette = ElencoOdette.Rows.Count;
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore: non ci sono UDC da creare per la PackList {0}", CodLista), tipoLog.ERROR);
- }
- // in primis comunque verifico che la bolla ci sia altrimenti non procedo (anche se avrebbe già dovuto controllare...)
- if (totOdette > 0)
- {
- // processo elenco Odette
- foreach (DS_Odette.OdetteRow rigaOdette in ElencoOdette)
- {
- stampaEtichettaOdette(rigaOdette.CampoUDC, printerName);
- }
- }
- else
- {
- logger.lg.scriviLog(string.Format("Attenzione: non ho trovaot etichette odette valide per la lista di prelievo {0}", CodLista), tipoLog.ERROR);
- }
- return answ;
- }
- ///
- /// stampa una singola etichetta odette
- ///
- ///
- ///
- ///
- public bool stampaEtichettaOdette(string UDC, string printerName)
- {
- bool answ = false;
- // chiamo il report...
- try
- {
- answ = reportPrinter.obj.stampaCartellino(tipoCartellino.cartOdette, UDC, printerName);
- }
- catch
- {
- logger.lg.scriviLog(String.Format("Errore nella stmapa del cartellino per l'UDC {0}", UDC), tipoLog.ERROR);
- }
- return answ;
- }
- ///
- /// determina se ci siano odette x la lista di prelievo
- ///
- ///
- ///
- public bool listaHasOdette(string codLista)
- {
- bool answ = false;
- try
- {
- DS_Odette.stp_OdetteStatoCreateRow rigaCreate = taOdCreate.GetData(codLista)[0];
- answ = rigaCreate.OdetteCreate > 0;
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce info se un gitterbox abbia una etichetta odette associata
- ///
- ///
- public bool gitterboxInOdette(string codGitterbox)
- {
- bool answ = false;
- try
- {
- answ = taOdette.getByUdc(codGitterbox).Rows.Count > 0;
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce info se un datamatrix faccia parte di un gitterbox con una etichetta odette associata
- ///
- public bool datamatrixInOdette(decimal codDataMatrix)
- {
- bool answ = false;
- string codGitterbox = DataMatrix.mgr.gitterboxFromDataMatrix(codDataMatrix);
- answ = gitterboxInOdette(codGitterbox);
- return answ;
- }
- ///
- /// Restituisce info se un datamatrix possa essere spostato tra 2 gitterbox (il suo d'origine e quello indicato),
- /// mantenendo l'omogeneità dei prodotti nel gitterbox.
- /// Verifiche:
- /// - se il datamatrix ha un gitterbox associato --> le prime 2 cifre dei gitterbox devono coincidere
- /// - se il datamatrix non ha un gitterbox associato --> rileggo gitterbox originale pre importazione e faccio verifica dei primi 2 char
- ///
- ///
- ///
- public bool dtMtxGtboxCompatibili(decimal codDataMatrix, string codGitterboxTo)
- {
- bool answ = false;
- string codGitterboxFrom = "";
- try
- {
- codGitterboxFrom = DataMatrix.mgr.gitterboxFromDataMatrix(codDataMatrix);
- if (codGitterboxFrom != "EmptyGBox")
- {
- answ = (codGitterboxFrom.Substring(0, 2) == codGitterboxTo.Substring(0, 2));
- }
- else
- {
- // cerco gitterbox originale...
- codGitterboxFrom = DataMatrix.mgr.gitterboxOrigFromDataMatrix(codDataMatrix);
- answ = (codGitterboxFrom.Substring(0, 2) == codGitterboxTo.Substring(0, 2));
- }
- }
- catch
- { }
- return answ;
- }
- ///
- /// restituisce info se un datamatrix esista
- ///
- ///
- public bool datamatrixEsiste(decimal codDataMatrix)
- {
- bool answ = false;
- try
- {
- answ = DataMatrix.mgr.taElencoDM.getByCode(codDataMatrix).Rows.Count > 0;
- }
- catch
- { }
- return answ;
- }
-
-
- #endregion
-
+ bool answ = false;
+ try
+ {
+ taOdette.caricaDatiBollaEtichettaOdette(memLayer.ML.cdv("CodCS"), UDC, numBolla.ToString(), dataBolla.ToString(), RaggMag, GrpBolla, particolare);
+ answ = true;
+ }
+ catch
+ {
+ answ = false;
+ }
+ return answ;
}
+
+ #endregion
+
+ #region area public
+
+ ///
+ /// singleton
+ ///
+ public static Odette mgr = new Odette();
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ ///
+ public string traduci(string lemma, string lingua)
+ {
+ return user_std.UtSn.Traduci(lemma, lingua);
+ }
+
+ ///
+ /// verifica l'esistenza di una bolla dato il suo codice + data
+ ///
+ /// cod raggr magazzino
+ /// gruppo bolla
+ /// codice bolla NUMERICO
+ /// data bolla formato numerico YYYYMMDD
+ /// codice particolare
+ ///
+ public bool checkCodBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
+ {
+ bool answ = false;
+ int righeBolla = 0;
+ // controllo che la bolla esista...
+ try
+ {
+ // provo a caricarle con stored...
+ taBORI.caricaDatiBolla(RaggMag, GrpBolla, numBolla.ToString(), dataBolla.ToString(), particolare);
+ // rileggo se presenti...
+ righeBolla = taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Rows.Count;
+ answ = (righeBolla >= 1);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in checkCodBolla:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ // controllo che la bolla non sia già associata... ovvero SENZA NESSUNA etichetta odette associata x quel particolare...
+ if (answ)
+ {
+ // controllo se trovo odette associate a tale bolla...
+ answ = (taOdette.getByBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare).Rows.Count == 0);
+ }
+ return answ;
+ }
+ ///
+ /// conteggia il num di colli x una data bolla
+ ///
+ /// cod raggr magazzino
+ /// gruppo bolla
+ /// codice bolla NUMERICO
+ /// data bolla formato numerico YYYYMMDD
+ /// codice particolare
+ ///
+ public int totColliBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
+ {
+ int answ = 0;
+ try
+ {
+ // calcolo il totale dei pezzi: ogni riga contiene il totale colli della bolla...
+ //answ = (int)taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare)[0].NRC1B;
+ answ = Convert.ToInt32(taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Compute("SUM(NRC1B)", ""));
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// conteggia il num di pezzi x una data bolla
+ ///
+ /// cod raggr magazzino
+ /// gruppo bolla
+ /// codice bolla NUMERICO
+ /// data bolla formato numerico YYYYMMDD
+ /// codice particolare
+ ///
+ public int totPezziBolla(string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare)
+ {
+ int answ = 0;
+ try
+ {
+ // rileggo se presenti...
+ answ = Convert.ToInt32(taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare).Compute("SUM(QTCNS)", ""));
+ //answ = (int)taBORI.getByKeyFull(RaggMag, GrpBolla, Convert.ToDecimal(numBolla), Convert.ToDecimal(dataBolla), particolare)[0].QTCNS;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ ///
+ /// crea tutte le righe encessarie alal stampa dei cartellini Odette dati lista di prelievo, bolla da associare
+ ///
+ /// codice lista di prelievo
+ /// cod raggr magazzino
+ /// gruppo bolla
+ /// codice bolla NUMERICO
+ /// data bolla formato numerico YYYYMMDD
+ /// codice particolare
+ /// IT/EN/...
+ /// in caso di errore e ritorno false, salva in sessione il messaggio di errore relativo in errCreazOdette
+ public bool creaOdetteByBollaPackList(string CodLista, string RaggMag, string GrpBolla, decimal numBolla, decimal dataBolla, string particolare, string lingua)
+ {
+ bool answ = false;
+ string errCreazOdette = "";
+ int totUdc = 0;
+ int totPz = 0;
+ int udcOk = 0;
+ DS_magazzino.RigheListePrelievoDataTable ElencoUdc = new DS_magazzino.RigheListePrelievoDataTable();
+ // conto totale etichette da creare
+ try
+ {
+ ElencoUdc = MagClass.magazzino.taRigheListePrelievo.getByCodLista(CodLista);
+ totUdc = ElencoUdc.Rows.Count;
+ totPz = (int)MagClass.magazzino.taElencoListePrelievo.getByCodLista(CodLista)[0].Prelevato;
+ }
+ catch
+ {
+ errCreazOdette = string.Format("Errore: non ci sono UDC da creare per la PackList {0}", CodLista);
+ logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
+ }
+ // in primis comunque verifico che la bolla ci sia altrimenti non procedo (anche se avrebbe già dovuto controllare...)
+ if (checkCodBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) && totUdc > 0)
+ {
+ // controllo se il totale colli corrisponde al totale UDC..
+ if (totColliBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) == totUdc || true) // controllo disattivato 2013.03.22 perché i colli riga sono i colli totali bolla
+ {
+ // controllo se il totale pezzi corrisponde al totale qta...
+ if (totPezziBolla(RaggMag, GrpBolla, numBolla, dataBolla, particolare) == totPz)
+ {
+ // leggo elenco UDC da packing list
+ foreach (DS_magazzino.RigheListePrelievoRow rigaUdc in ElencoUdc)
+ {
+ // per ogni UDC creo una riga
+ taOdette.upsertUdc(rigaUdc.UDC, memLayer.ML.cdv("CodCS"), numBolla.ToString(), dataBolla.ToString(), RaggMag, GrpBolla, particolare, CodLista, memLayer.ML.confReadString("indStabFrom"), rigaUdc.Qta.ToString());
+ udcOk++;
+ // per ogni riga inserisco traduzione nella lingua richiesta
+ caricaEtichetteLinguaPerOdette(rigaUdc.UDC, lingua);
+ // vado a caricare i dati dalla tab dei dati bolle
+ caricaDatiBollaEtichettaOdette(rigaUdc.UDC, RaggMag, GrpBolla, numBolla, dataBolla, particolare);
+ // effettuo check della riga odette e determino se sia conforme
+ updateStatoOdette(rigaUdc.UDC);
+ }
+ }
+ else
+ {
+ errCreazOdette = string.Format("Errore assegnazione bolle/odette, il num di pezzi non corrisponde: num bolla {0} del {1}, lista prelievo {2}", numBolla, dataBolla, CodLista);
+ logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ errCreazOdette = string.Format("Errore assegnazione bolle/odette, il num di colli non corrisponde: num bolla {0} del {1}, lista prelievo {2}", numBolla, dataBolla, CodLista);
+ logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ errCreazOdette = string.Format("Tentativo di generazione etichette odette da bolla inesistente/già impiegata: codice {0} del {1}", numBolla, dataBolla);
+ logger.lg.scriviLog(errCreazOdette, tipoLog.ERROR);
+ }
+ // controllo se tutte le etichette sono sstate create
+ if (totUdc == udcOk)
+ {
+ answ = true;
+ }
+ memLayer.ML.setSessionVal("errCreazOdette", errCreazOdette);
+ return answ;
+ }
+ ///
+ /// Stampa tutte le etichette odette di una lista di prelievo
+ ///
+ ///
+ ///
+ ///
+ public bool stampaOdettePackingList(string CodLista, string printerName)
+ {
+ bool answ = false;
+ int totOdette = 0;
+ DS_Odette.OdetteDataTable ElencoOdette = new DS_Odette.OdetteDataTable();
+ // conto totale etichette Odette con StatusOK=1 corrispondenti a lista prelievo
+ try
+ {
+ ElencoOdette = taOdette.getByCodLista(CodLista);
+ totOdette = ElencoOdette.Rows.Count;
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore: non ci sono UDC da creare per la PackList {0}", CodLista), tipoLog.ERROR);
+ }
+ // in primis comunque verifico che la bolla ci sia altrimenti non procedo (anche se avrebbe già dovuto controllare...)
+ if (totOdette > 0)
+ {
+ // processo elenco Odette
+ foreach (DS_Odette.OdetteRow rigaOdette in ElencoOdette)
+ {
+ stampaEtichettaOdette(rigaOdette.CampoUDC, printerName);
+ }
+ }
+ else
+ {
+ logger.lg.scriviLog(string.Format("Attenzione: non ho trovaot etichette odette valide per la lista di prelievo {0}", CodLista), tipoLog.ERROR);
+ }
+ return answ;
+ }
+ ///
+ /// stampa una singola etichetta odette
+ ///
+ ///
+ ///
+ ///
+ public bool stampaEtichettaOdette(string UDC, string printerName)
+ {
+ bool answ = false;
+ // chiamo il report...
+ try
+ {
+ answ = reportPrinter.obj.stampaCartellino(tipoCartellino.cartOdette, UDC, printerName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(String.Format("Errore nella stmapa del cartellino per l'UDC {0}", UDC), tipoLog.ERROR);
+ }
+ return answ;
+ }
+ ///
+ /// determina se ci siano odette x la lista di prelievo
+ ///
+ ///
+ ///
+ public bool listaHasOdette(string codLista)
+ {
+ bool answ = false;
+ try
+ {
+ DS_Odette.stp_OdetteStatoCreateRow rigaCreate = taOdCreate.GetData(codLista)[0];
+ answ = rigaCreate.OdetteCreate > 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce info se un gitterbox abbia una etichetta odette associata
+ ///
+ ///
+ public bool gitterboxInOdette(string codGitterbox)
+ {
+ bool answ = false;
+ try
+ {
+ answ = taOdette.getByUdc(codGitterbox).Rows.Count > 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce info se un datamatrix faccia parte di un gitterbox con una etichetta odette associata
+ ///
+ public bool datamatrixInOdette(decimal codDataMatrix)
+ {
+ bool answ = false;
+ string codGitterbox = DataMatrix_mgr.gitterboxFromDataMatrix(codDataMatrix);
+ answ = gitterboxInOdette(codGitterbox);
+ return answ;
+ }
+ ///
+ /// Restituisce info se un datamatrix possa essere spostato tra 2 gitterbox (il suo d'origine e quello indicato),
+ /// mantenendo l'omogeneità dei prodotti nel gitterbox.
+ /// Verifiche:
+ /// - se il datamatrix ha un gitterbox associato --> le prime 2 cifre dei gitterbox devono coincidere
+ /// - se il datamatrix non ha un gitterbox associato --> rileggo gitterbox originale pre importazione e faccio verifica dei primi 2 char
+ ///
+ ///
+ ///
+ public bool dtMtxGtboxCompatibili(decimal codDataMatrix, string codGitterboxTo)
+ {
+ bool answ = false;
+ string codGitterboxFrom = "";
+ try
+ {
+ codGitterboxFrom = DataMatrix_mgr.gitterboxFromDataMatrix(codDataMatrix);
+ if (codGitterboxFrom != "EmptyGBox")
+ {
+ answ = (codGitterboxFrom.Substring(0, 2) == codGitterboxTo.Substring(0, 2));
+ }
+ else
+ {
+ // cerco gitterbox originale...
+ codGitterboxFrom = DataMatrix_mgr.gitterboxOrigFromDataMatrix(codDataMatrix);
+ answ = (codGitterboxFrom.Substring(0, 2) == codGitterboxTo.Substring(0, 2));
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// restituisce info se un datamatrix esista
+ ///
+ ///
+ public bool datamatrixEsiste(decimal codDataMatrix)
+ {
+ bool answ = false;
+ try
+ {
+ answ = DataMatrix_mgr.taElencoDM.getByCode(codDataMatrix).Rows.Count > 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+
+ #endregion
+
+ }
}
\ No newline at end of file
diff --git a/GMW_data/UserControlBCodeMan.cs b/GMW_data/UserControlBCodeMan.cs
index e82f20d7..2593ed82 100644
--- a/GMW_data/UserControlBCodeMan.cs
+++ b/GMW_data/UserControlBCodeMan.cs
@@ -5,7 +5,10 @@ namespace GMW_data
{
public class UserControlBCodeMan : GMW_data.UserControl
{
-
+ ///
+ /// Oggetto locale gestione classe datamatrix...
+ ///
+ protected DataMatrix DataMatrix_mgr = new DataMatrix();
#region Conf stili css
///
@@ -283,7 +286,7 @@ namespace GMW_data
string answ = "";
try
{
- answ = DataMatrix.mgr.taVerifica.GetData(datamatrix)[0].FormatoDtmx;
+ answ = DataMatrix_mgr.taVerifica.GetData(datamatrix)[0].FormatoDtmx;
}
catch
{ }
@@ -297,7 +300,7 @@ namespace GMW_data
string answ = "";
try
{
- answ = DataMatrix.mgr.taTDtmx.getByParticolare(Particolare)[0].FormatoDtmx;
+ answ = DataMatrix_mgr.taTDtmx.getByParticolare(Particolare)[0].FormatoDtmx;
}
catch
{ }
@@ -315,11 +318,11 @@ namespace GMW_data
string answ = "";
if (byTable)
{
- answ = DataMatrix.mgr.taDtxAcquisiti.getByKey(barcodeIn)[0].Particolare;
+ answ = DataMatrix_mgr.taDtxAcquisiti.getByKey(barcodeIn)[0].Particolare;
}
else
{
- answ = DataMatrix.mgr.taDecode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare;
+ answ = DataMatrix_mgr.taDecode.GetData(barcodeIn, FormatoDtmxLinea)[0].Particolare;
}
return answ;
}