using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SteamWare; using System.Drawing.Printing; using GMW_data; namespace GMW_UT { public partial class BCodeCall : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { /************************************************* * nota funzionamento... * * se legge BCDL1 --> toglie BCD e manda questo url * http://iis02/GMW-UT/BCodeCall.aspx?valore=L1 * ****************************************************/ string answ = "nd"; // eventuale log... if (memLayer.ML.confReadInt("_logLevel") > 6) { logger.lg.scriviLog(string.Format("Richiesta stampa barode da rPI:{0}valore: {1}", Environment.NewLine, valore), tipoLog.INFO); } // chiamo stampa try { answ = "OK"; stampaBCode(); } catch (Exception exc) { logger.lg.scriviLog(string.Format("ERRORE in stampa barode da rPI:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); answ = "KO"; } // ripulisco pagina restituita e tolgo html (solo codice OK/KO) Response.Clear(); Response.Write(answ); Context.Response.End(); } /// /// valore richiesto tramite URL /// public string valore { get { // valore EVENTUALMENTE trimmando BCD... return memLayer.ML.QSS("valore").Replace("BCD", ""); } } /// /// testo da stampare in chiaro /// public string testoLabel { get { return string.Format(memLayer.ML.confReadString("bcodeLabFormatPI"), DateTime.Now, valore); } } /// /// testo in codice 39 /// public string bCodeLabel { get { return string.Format(memLayer.ML.confReadString("bcodeValFormatPI"), DateTime.Now, valore); } } /// /// lancio stampa etichetta /// protected void stampaBCode() { // attenzione: page size deve essere uguale su printer e su richiesta!!! 62 x 29 mm = 2.44 x 1.14 pollici PaperSize pS = new PaperSize("label", memLayer.ML.confReadInt("bcodeLabelWidth"), memLayer.ML.confReadInt("bcodeLabelHeight")); // recupero printer da nome postazione string stampante = ""; try { stampante = DataProxy.obj.taElPost.getByCod(valore)[0].stampante; } catch { } if (stampante != "") { // stampo il vero bcode su etichettatrice!!! ATTENZIONE bCodePrinter.man.Print(stampante, pS, testoLabel, bCodeLabel, memLayer.ML.confReadInt("bcodeFontBase")); } else { logger.lg.scriviLog(string.Format("ERRORE in stampa barode da rPI:stampante non trovata{0}valore: {1}", Environment.NewLine, valore), tipoLog.ERROR); } } } }