//private void ExportarDatos(List<InfoFieldBook> datos) //{ // string nombreArchivo = ""; // var book = FuncionesExcel.ExportaDetalleEntryList(datos); // SaveFileDialog saveFileDialog1 = new SaveFileDialog(); // saveFileDialog1.InitialDirectory = @"C:\"; // saveFileDialog1.Title = "Save Excel Files"; // saveFileDialog1.DefaultExt = "xlsx"; // saveFileDialog1.Filter = "Excel files (*.xlsx)|*.xlsx"; // saveFileDialog1.FilterIndex = 2; // saveFileDialog1.RestoreDirectory = true; // if (saveFileDialog1.ShowDialog() == DialogResult.OK) // { // nombreArchivo = saveFileDialog1.FileName; // try // { // book.SaveAs(nombreArchivo); // MessageBox.Show("Archivo Creado!", "Módulo Carga", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); // } // catch (Exception ex) // { // MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); // } // } //} #endregion #region -------Rutina Barra de Progreso------- private void bg_DoWork(object sender, DoWorkEventArgs e) { totalEmpleadosProcesar = datos.Count; foreach (var item in datos) { infoF = InfoFieldBookBusiness.GetIndEuid(item.indEuid, item.euid); if (infoF != null) { //infoF.Id = infoF.Id; //infoF.cc = item.cc; //infoF.client = item.client; //infoF.codInternacion = item.codInternacion; //infoF.CodPermanencia = item.CodPermanencia; //infoF.codReception = item.codReception; //infoF.country = item.country; //infoF.crop = item.crop; //infoF.ent = item.ent; //infoF.EntName = item.EntName; //infoF.EntRole = item.EntRole; //infoF.gmoEvent = item.gmoEvent; //infoF.GranosHilera = item.GranosHilera; //infoF.instructions = item.instructions; //infoF.location = item.location; //infoF.LotId = item.LotId; //infoF.opExpName = item.opExpName; //infoF.order = item.order; //infoF.Owner = item.Owner; //infoF.plt = item.plt; //infoF.ResImportation = item.ResImportation; //infoF.rng = item.rng; //infoF.sag = item.sag; //infoF.year = item.year; infoF.breedersCode1 = item.breedersCode1; infoF.breedersCode2 = item.breedersCode2; infoF.breedersCode3 = item.breedersCode3; infoF.breedersCode4 = item.breedersCode4; infoF.BreedersInstructions1 = item.BreedersInstructions1; infoF.BreedersInstructions2 = item.BreedersInstructions2; infoF.BreedersInstructions3 = item.BreedersInstructions3; infoF.BreedersInstructions4 = item.BreedersInstructions4; infoF.fechaModificacion = (DateTime?)DateTime.Now; infoF.projecLead = item.projecLead; infoF.projectCode = item.projectCode; infoF.shelling = item.shelling; infoF.shipTo = item.shipTo; infoF.targears = item.targears; infoF.targetKern = item.targetKern; infoF.targetWg = item.targetWg; infoF.obs = item.obs; modificados++; } else { infoF = new InfoFieldBook(); infoF = item; infoF.fechaCarga = DateTime.Now; insertados++; } InfoFieldBookBusiness.GrabaInformacion(infoF); progreso++; //Aumentando el progreso porciento = Convert.ToInt16((((double)progreso / (double)totalEmpleadosProcesar) * 100.00)); //Calculo del porcentaje bg.ReportProgress(porciento); } }
private void ImprimeEtiqueta() { string euidC = ""; if (txtEuid.Text != "") { euidC = txtEuid.Text; } var infoField = InfoFieldBookBusiness.GetIndEuid(txtIndEuid.Text, euidC); if (infoField != null && impresora != "") { zebraInstructions = new StringBuilder(); string bc1 = infoField.breedersCode1 ?? ""; string bc2 = infoField.breedersCode2 ?? ""; string bc3 = infoField.breedersCode3 ?? ""; string bc4 = infoField.breedersCode4 ?? ""; string euid = txtEuid.Text; string shipTo = infoField.shipTo; string order = infoField.order.ToString() ?? ""; string tw = movimientoPacking.totalWeight.ToString(); string tk = movimientoPacking.totalKernels.ToString(); string te = movimientoPacking.totalEars.ToString(); string year = (infoField.year == null) ? "" : infoField.year.ToString(); string location = infoField.location ?? ""; string rng = (infoField.rng == null) ? "" : infoField.rng.ToString(); string plt = (infoField.plt == null) ? "" : infoField.plt.ToString(); string ent = (infoField.ent == null) ? "" : infoField.ent.ToString(); zebraInstructions.Append("^XA\n"); //Codigo Barra Euid zebraInstructions.Append("^BY2,3,60" + Environment.NewLine); zebraInstructions.Append("^FO20,20^BC^FD" + euid + "^FS" + Environment.NewLine); //QR Euid zebraInstructions.Append("^FT687,112^BQN,2,4" + Environment.NewLine); zebraInstructions.Append(@"^FH\^FDLA," + euid + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT36,155^A0N,39,38^FH\^FDShip To^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT63,208^A0N,39,38^FH\^FD" + shipTo + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT290,155^A0N,39,38^FH\^FD" + bc1 + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT694,155^A0N,39,38^FH\^FDOrder^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT723,208^A0N,39,38^FH\^FD" + order + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT369,231^A0N,39,38^FH\^FD" + bc2 + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT36,273^A0N,25,31^FH\^FD" + bc3 + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT36,311^A0N,25,31^FH\^FD" + bc4 + "^FS" + Environment.NewLine); if (movimientoPacking.indEuid != "") { //Codigo Barra IndEuid zebraInstructions.Append("^BY2,3,60" + Environment.NewLine); zebraInstructions.Append("^FO20,320^BC^FD" + movimientoPacking.indEuid + "^FS" + Environment.NewLine); //QR IndEuid zebraInstructions.Append("^FT687,389^BQN,2,4" + Environment.NewLine); zebraInstructions.Append(@"^FH\^FDLA," + movimientoPacking.indEuid + "^FS" + Environment.NewLine); } zebraInstructions.Append(@"^FT40,423^A0N,28,28^FH\^FDWeight (gr):^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT85,461^A0N,28,28^FH\^FD" + tw + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT352,423^A0N,28,28^FH\^FDKernels:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT384,461^A0N,28,28^FH\^FD" + tk + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT665,423^A0N,28,28^FH\^FDEars:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT685,461^A0N,28,28^FH\^FD" + te + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT32,500^A0N,28,28^FH\^FDYear:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT105,499^A0N,27,28^FH\^FD" + year + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT289,500^A0N,28,28^FH\^FDLoc:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT348,499^A0N,27,28^FH\^FD" + location + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT32,544^A0N,28,28^FH\^FDRNG:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT114,543^A0N,27,28^FH\^FD" + rng + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT355,544^A0N,28,28^FH\^FDPLT:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT445,543^A0N,27,28^FH\^FD" + plt + "^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT636,544^A0N,28,28^FH\^FDENT:^FS" + Environment.NewLine); zebraInstructions.Append(@"^FT707,543^A0N,27,28^FH\^FD" + ent + "^FS" + Environment.NewLine); zebraInstructions.Append("^PQ1,0,1,Y" + Environment.NewLine); zebraInstructions.Append("^XZ"); //Habilitar en la casa string selectedPrinterName = impresora;//"ZDesigner ZM400 200 dpi (ZPL)"; new ZebraPrinter(selectedPrinterName).Print(zebraInstructions.ToString()); } }
public static ResultadoCarga SaveExcelData(List <InfoFieldBook> data) { int rowUpdated = 0; int rowInserted = 0; ResultadoCarga status = new ResultadoCarga(); InfoFieldBook ultimoProcesado = new InfoFieldBook(); try { foreach (var result in data) { var row = InfoFieldBookBusiness.GetIndEuid(result.indEuid, result.euid); if (row != null) { rowUpdated++; row.fechaModificacion = DateTime.Now; } else { row = new InfoFieldBook(); rowInserted++; row.fechaCarga = DateTime.Now; } row.breedersCode1 = result.breedersCode1; row.breedersCode2 = result.breedersCode2; row.breedersCode3 = result.breedersCode3; row.breedersCode4 = result.breedersCode4; row.cc = result.cc; row.client = result.client; row.codInternacion = result.codInternacion; row.codReception = result.codReception; row.country = result.country; row.crop = result.crop; row.ent = result.ent; row.euid = result.euid; row.gmoEvent = result.gmoEvent; row.indEuid = result.indEuid; row.instructions = result.instructions; row.location = result.location; row.obs = result.obs; row.opExpName = result.opExpName; row.order = result.order; row.plt = result.plt; row.projecLead = result.projecLead; row.projectCode = result.projectCode; row.rng = result.rng; row.sag = result.sag; row.shelling = result.shelling; row.shipTo = result.shipTo; row.targears = result.targears; row.targetKern = result.targetKern; row.targetWg = result.targetWg; row.year = result.year; ultimoProcesado = row; var obj = InfoFieldBookBusiness.GrabaInformacion(row); } } catch (Exception ex) { status.Error = "Error: " + ex.Message; } status.TotalRows = data.Count(); status.NumeroActualizados = rowUpdated; status.NumeroInsertados = rowInserted; status.UltimoProcesado = ultimoProcesado; return(status); }