public IActionResult Index(SerialPrintModel item) { bool print = false; if (null != item.Serial) { item = ConnectionTraza.GetInformationSerial(this.AppSettings, item.Serial); string zpl = replaceZPL(this.AppSettings, item); print = printLabel(this.AppSettings, zpl); } return(View()); }
public static SerialPrintModel GetInformationSerial(AppSettings appSettings, string serial) { SerialPrintModel label = new SerialPrintModel(); string queryString = "SELECT * FROM access$ where d_obj# = 1753"; //string sql = "SELECT * FROM boxes"; string oracleConn = appSettings.Traza_Connection; #region Cambiar por la version en el server de traza //using (OracleConnection connection = new OracleConnection(oracleConn)) //{ // OracleCommand command = new OracleCommand(queryString, connection); // connection.Open(); // OracleDataReader reader = command.ExecuteReader(); // try // { // while (reader.Read()) // { // label.MLFB = reader.GetValue(0).ToString(); // label.Order = reader.GetValue(1).ToString(); // label.Quantity = 80; // label.Serial = reader.GetValue(2).ToString(); // label.PackingType = "Tarima"; // } // } // finally // { // // always call Close when done reading. // reader.Close(); // } //} #endregion #region Borrar SerialPrintModel labelTest = new SerialPrintModel(); labelTest.Serial = "1234567890"; labelTest.MLFB = "A2C1781540095"; labelTest.Quantity = 100; labelTest.PackingType = "Tarima"; return(labelTest); #endregion //return label; }
private string replaceZPL(AppSettings appSettings, SerialPrintModel label) { if (label != null) { string zplBase = appSettings.ZPL; StringBuilder zpl = new StringBuilder(zplBase); zpl.Replace("*tittle*", "Blackflush de Producto Terminado"); zpl.Replace("*em*", "Etiqueta Master"); zpl.Replace("*mlfb*", label.MLFB); zpl.Replace("*sh*", label.PackingType); zpl.Replace("*ta*", "Tarima"); zpl.Replace("*qan*", label.Quantity.ToString()); zpl.Replace("sr", label.Serial); zpl.Replace("*date*", DateTime.Now.ToString()); return(zpl.ToString()); } return(null); }
private string replaceZPL(SerialPrintModel label) { if (label != null) { string zplBase = "^XA^RFW,H,1,2,1^FD4000^FS^RFW,A,2,16,1^FD*RFID*^FS^A0N,49,48^FO60,25^CI0^FD*tittle*^FS^A0N,25,26^FO65,70^CI0^FD*em*^FS^A0N,33,32^FO70,100^CI0^FDNo. de Parte:^FS^A0N,33,32^FO280,100^CI0^FD*mlfb* - *sh*R^FS^A0N,33,32^FO70,134^CI0^FDCantidad:^FS^A0N,33,32^FO200,132^CI0^FD*qn*^FS^A0N,33,32^FO320,132^CI0^FDTipo de Embarque:^FS^A0N,33,32^FO610,132^CI0^FD*ta*^FS^A0N,33,32^FO70,185^CI0^FDSerial:^FS^BY2,2.6^FO65,235^B3N,N,60,Y,N^FDsr^FS^A0N,17,18^FO73,360^CI0^FDFecha:^FS^A0N,17,18^FO126,360^CI0^FD*date*^FS^A0N,33,25^FO530,360^CI0^FDRFID^FS^PQ1,0,1,Y^XZ"; StringBuilder zpl = new StringBuilder(zplBase); zpl.Replace("*RFID*", Mlfb16char(label.MLFB)); zpl.Replace("*tittle*", "Blackflush de Producto Terminado"); zpl.Replace("*em*", "Etiqueta Master"); zpl.Replace("*mlfb*", label.MLFB); zpl.Replace("*sh*", label.PackingType); zpl.Replace("*ta*", "Tarima"); zpl.Replace("*qn*", label.Quantity.ToString()); zpl.Replace("sr", label.Serial); zpl.Replace("*date*", DateTime.Now.ToString()); return(zpl.ToString()); } return(null); }