예제 #1
0
 public JsonResult cancelaLote(string idLot)
 {
     try
     {
         var           lot    = db.TBL_LOTE_PRODUCCION.Find(idLot);
         var           detLot = db.TBL_DETALLE_LOTE.Where(x => x.ID_LOTE.Equals(idLot)).ToList()[0];
         UtileriaComun aux    = new UtileriaComun();
         if (detLot.VEDIDOS == 0 && aux.bajaStock(lot.ID_PRODUC, detLot.CANTIDAD, 2))
         {
             lot.CANCELADO = true;
             db.SaveChanges();
             return(Json(true));
         }
         else
         {
             return(Json(false));
         }
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
예제 #2
0
        public FileResult tarjetonLote(string id, string product)
        {
            //var ruta = Server.MapPath("");
            string ruta    = @"C:\Users\Sistemas\Pictures\qrLotes\" + id + ".png";
            var    l       = db.TBL_LOTE_PRODUCCION.Where(x => x.ID_LOTE.Equals(id)).ToList();
            string mensaje = String.Empty;

            if (l != null)
            {
                mensaje = id + "," + product + "," + l[0].DESCRIPCION + "," + l[0].FECHA_PRODUC;
            }

            using (UtileriaComun util = new UtileriaComun())
            {
                util.qrLote(mensaje, id);
            }

            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports/tarProduccion.rpt")));

            rd.SetParameterValue("Producto", l[0].DESCRIPCION);
            rd.SetParameterValue("LOTE", id);
            rd.SetParameterValue("ruta", ruta);
            rd.SetParameterValue("FECHA", l[0].FECHA_PRODUC);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);

            return(File(stream, "application/pdf", "Tarjeton " + id + ".pdf"));
            //return File(ruta,"application/png",id+".png");
        }