//Guarda el lote
        public void crearLote(object sender, EventArgs e)
        {
            try
            {
               lote = new Lote();
               lote.nroLote = int.Parse(nroLote.Text);
               lote.fechaElaboracion = DateTime.Parse(ChosenDate.Text);
               lote.fechaVto = DateTime.Parse(fechaVencimiento.Text);
               
                //comparar ambas fechas para que fechaElab < fechaVto
            
                iLote.save<Lote>(lote);
                
   
                String msj = "El lote ha sido creado correctamente.";
                Intermediario.confirmarCambios();
                this.Page.Response.Write("<script language='JavaScript'>window.alert('" + msj + "');</script>");

                nroLote.Text = null;
                ChosenDate.Text = null;
                fechaVencimiento.Text = null;

            }
            catch (Exception) { }
        }
        /******************************************************************** HOME Estoque********************************************************************/
        public ActionResult HomeEstoque()
        {
            if (Session["UsuarioLogado"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }

            Requisicao R = new Requisicao();

            if (Session["NivelAcesso"].Equals(4))
            {
                Session["NotificacaoDiretor"] = R.NotificacaoDiretor();
            }
            else if (Session["NivelAcesso"].Equals(3))
            {
                Session["NotificacaoCoordenador"] = R.NotificacaoCoordenador();
            }

            Curso C = new Curso();

            ViewBag.Curso = C.ListarCursos(Session["NIF"].ToString());

            Turma T = new Turma();

            ViewBag.Turmas = T.ListarTurmas();

            Lote L = new Lote();

            ViewBag.Lotes = L.ListarLotes();

            Formulacao F = new Formulacao();

            ViewBag.Formulacoes = F.ListarFormulacoes();

            Ingrediente I = new Ingrediente();

            ViewBag.Ingredientes = I.ListarIngredientes();

            UsuarioController UC = new UsuarioController();

            ViewBag.Imagens = Usuario.ListarImagem(Session["NIF"]);//Comando para lista a imagem com a resolução correta
            return(View());
        }
        private void ImportarDiretorio(string imagensDoLote, Lote lote)
        {
            Log.Application.DebugFormat("Inserindo paginas do lote [{0}]", lote.Id);
            var imagens = this.fileSystem.GetFiles(imagensDoLote, "*.*");

            var documentoLista = this.unitOfWork.Obter(() => this.documentoRepositorio
                                                       .ObterTodosPorLote(lote.Id).Where(x => x.Status != DocumentoStatus.Excluido));

            foreach (var imagem in imagens)
            {
                var tipoDocumentoId = this.ObterTipoDocumento(imagem);
                var documentoAtual  = documentoLista.LastOrDefault(x => x.TipoDocumento.Id == tipoDocumentoId);

                if (documentoAtual != null)
                {
                    this.unitOfWork.Transacionar(() => this.salvarPaginasServico.Executar(imagem, documentoAtual, documentoAtual.Paginas.Count + 1));
                }
            }
        }
 public static bool CadastrarSaidaDeLote(Lote lote)
 {
     try
     {
         if (LoteDAO.ValidarSaidaLote(lote.Id))
         {
             HistoricoDAO.GerarHistoricoSaidaLote(lote);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #5
0
        public ActionResult IdLote(VentaViewModels datos)
        {
            var venta = new VentaViewModels();

            Lote lote = new Lote(new DBLote());

            venta.Lotes = lote.FindEstadoLoti();

            //Cliente _cliente = new Cliente(new BdClientes());
            //venta.Cliente = _cliente.SelectForId(datos.ClienteId);
            venta.Cliente = cliente;

            Empleados emp = new Empleados(new DBEmpleados());

            venta.Empleado = emp.SelectForId(datos.EmpVentaId);
            empleado       = venta.Empleado;

            return(View(venta));
        }
        public async Task <IActionResult> Post(Lote model)
        {
            try
            {
                model.DataCriacao = DateTime.Today;
                _repo.Add(model);

                if (await _repo.SaveChangesAsync())
                {
                    return(Created($"/lote-form/{model.Id_Lote}", model));
                }
            }
            catch (System.Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de Dados Falhou" + e.Message));
            }

            return(BadRequest());
        }
Exemple #7
0
        private void SalvarLote(Lote lote)
        {
            this.loteRepositorio.Salvar(lote);

            foreach (var processo in lote.Processos)
            {
                this.processoRepositorio.Salvar(processo);

                foreach (var documento in processo.Documentos)
                {
                    this.documentoRepositorio.Salvar(documento);

                    foreach (var pagina in documento.Paginas)
                    {
                        this.paginaRepositorio.Salvar(pagina);
                    }
                }
            }
        }
        private void StockCeros()
        {
            try
            {
                if (Ambiente.Pregunta("Este proceso eliminará la existencia de los lotes vinculados al articulo y su nombre quedará como responsable: Continuar"))
                {
                    int index = 0;
                    foreach (var p in partidas)
                    {
                        if (p.LoteId != null)
                        {
                            lote = loteController.SelectOne((int)p.LoteId);
                        }
                        producto = productoController.SelectOne(p.ProductoId);

                        if (lote != null)
                        {
                            lote.StockRestante = 0;
                            loteController.Update(lote);
                        }
                        if (producto != null)
                        {
                            producto.Stock     = 0;
                            producto.UpdatedBy = Ambiente.LoggedUser.UsuarioId;
                            productoController.Update(producto);
                        }

                        ActualizaCantidad(0, index, true);
                        index++;
                    }

                    inventario.UpdatedBy = Ambiente.LoggedUser.UsuarioId;
                    inventario.UpdatedAt = DateTime.Now;
                    inventarioController.Update(inventario);
                    ReCargaGrid();
                    Ambiente.Mensaje("Proceso concluido");
                }
            }
            catch (Exception ex)
            {
                Ambiente.Mensaje(ex.Message);
            }
        }
        public ActionResult LoteVisualizar(int id)
        {
            LoteBus      loteBus    = new LoteBus();
            Lote         lote       = loteBus.Obter(id);
            List <Lista> origemTipo = ListaCredenciadoBus.DocumentosFitossanitario.Where(x => x.Id == ((int)eDocumentoFitossanitarioTipo.CFO).ToString() || x.Id == ((int)eDocumentoFitossanitarioTipo.CFOC).ToString()).ToList();

            LoteVM vm = new LoteVM(loteBus.ObterEmpreendimentosResponsaveis(), origemTipo, lote);

            vm.IsVisualizar = true;

            if (Request.IsAjaxRequest())
            {
                return(PartialView("LotePartial", vm));
            }
            else
            {
                return(View(vm));
            }
        }
Exemple #10
0
        public ActionResult Edit(LoteViewModels model)
        {
            if (ModelState.IsValid)
            {
                Lotes        = dbCtx.Lote.FirstOrDefault(a => a.Id == model.Id);
                Lotes.Precio = model.Precio;

                Lotes.MedidaId       = model.MedidaId;
                Lotes.EstadoLoteId   = model.EstadoLoteId;
                Lotes.LotificadoraId = model.LotificadoraId;
                Lotes.ManzanaId      = model.ManzanaId;
                Lotes.AreaId         = model.AreaId;
                Lotes.InteresId      = model.InteresId;

                dbCtx.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemple #11
0
        public ActionResult Edit(int id)
        {
            DBLote         dblote         = new DBLote();
            Lote           lote           = new Lote(dblote);
            DBLotificadora dblotificadora = new DBLotificadora();
            Lotificadora   lotifi         = new Lotificadora(dblotificadora);
            DBManzana      dbmanzana      = new DBManzana();
            Manzana        manzana        = new Manzana(dbmanzana);
            DBEstadoLote   dbestado       = new DBEstadoLote();
            EstadoLote     estado         = new EstadoLote(dbestado);

            LoteIngresoViewModels lote2 = new LoteIngresoViewModels();

            lote2 = lote.SelectForId(id);
            lote2.lotificadoras = lotifi.SelectAll();
            lote2.manzanas      = manzana.SelectAll();
            lote2.estados       = estado.SelectAll();
            return(View(lote2));
        }
        internal static void Init()
        {
            RService.Log("(Init) " + Name + ": Começando o processamento.. at {0}", Path.GetTempPath() + Name + ".txt");

            try
            {
                //Inicializa as listas e variáveis que serão usadas pelo robô
                CurrentPage      = 1;
                Lote             = LoteController.CreateLote(43, 1249);
                repo             = new LicitacaoRepository();
                Cidades          = CidadeController.GetNameToCidade(Constants.TCMCE_UF);
                NameToOrgao      = OrgaoController.GetNomeUfToOrgao();
                NameToModalidade = ModalidadeController.GetNameToModalidade();

                HtmlDocument htmlDoc = WebHandle.GetHtmlDocOfPage(string.Format(Constants.TCMCE_PAGE, CurrentPage, DateTime.Today.ToString("dd-MM-yyyy"), DateTime.Today.AddYears(1).ToString("dd-MM-yyyy")), Encoding.GetEncoding("UTF-8"));

                //O GetLastPage pega o código Html e o vasculha para encontrar o valor da última página
                int lastPage = GetLastPage(htmlDoc);

                while (CurrentPage != lastPage)
                {
                    RService.Log("(Init) " + Name + ": Percorrendo os links da página.. " + CurrentPage + " at {0}", Path.GetTempPath() + Name + ".txt");

                    HtmlNode licList = htmlDoc.DocumentNode.Descendants("table").SingleOrDefault(x => x.Id.Equals("table"));

                    foreach (var lic in licList.Descendants("tr"))
                    {
                        if (!lic.InnerHtml.Contains("Licitação"))
                        {
                            HandleCreate(lic);
                        }
                    }

                    CurrentPage++;
                    htmlDoc = WebHandle.GetHtmlDocOfPage(string.Format(Constants.TCMCE_PAGE, CurrentPage, DateTime.Today.ToString("dd-MM-yyyy"), DateTime.Today.AddYears(1).ToString("dd-MM-yyyy")), Encoding.GetEncoding("ISO-8859-1"));
                }
            }
            catch (Exception e)
            {
                RService.Log("Exception (Init) " + Name + ": " + e.Message + " / " + e.StackTrace + " / " + e.InnerException + " at {0}", Path.GetTempPath() + Name + ".txt");
            }
        }
Exemple #13
0
        public void UCSalidaStock_Load(object sender, EventArgs e, Trabajador trab)
        {
            List <Almacen> listAlmacen = repArea.GetListAlm();

            CBAlmacen.ValueMember   = "ID_Almacen";
            CBAlmacen.DisplayMember = "nombreAlmacen";
            CBAlmacen.DataSource    = listAlmacen;

            DGVStock.DataSource = repref.GetStock();

            if (repLote.GetLast() != null)
            {
                Lote lote = repLote.GetLast();
                TxtLote.Text = lote.numLote++.ToString();
            }
            else
            {
                TxtLote.Text = "1";
            }
        }
 public static bool CadastrarEntradaDeLote(Lote lote)
 {
     try
     {
         if (LoteDAO.ValidarNumeroDeLote(lote.Id) && LoteDAO.ValidarDataDeVencimento(lote.DataDeVencimento) &&
             LoteDAO.ValidarDataDeFabricacao(lote.DataDeFabricacao))
         {
             LoteDAO.CadastrarLote(lote);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #15
0
        public static bool GerarHistoricoEntradaLote(Lote lote)
        {
            try
            {
                Historico historico = new Historico();

                historico.Data           = DateTime.Now;
                historico.Lote           = lote;
                historico.TipoDeRegistro = Context.TipoDeRegistro.Where(t => t.Id == 1).FirstOrDefault();
                historico.Usuario        = (Usuario)Application.Current.Properties["UsuarioLogado"];

                Context.Historico.Add(historico);
                Context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        private void instanciarLote()
        {
            Lote lote;

            foreach (DataGridViewRow row in this.dgvVenta.Rows)
            {
                decimal costo = bd.convertirDecimal(row.Cells[7].Value.ToString());
                if (costo > 0)
                {
                    int     cantidad          = bd.convertirEntero(row.Cells[3].Value.ToString());
                    decimal precioUnitario    = bd.convertirDecimal(row.Cells[4].Value.ToString());
                    int     cantidadPaquete   = bd.convertirEntero(row.Cells[5].Value.ToString());
                    int     cantidadEnPaquete = bd.convertirEntero(row.Cells[6].Value.ToString());
                    string  expiracion        = row.Cells[8].Value.ToString();
                    int     id = bd.convertirEntero(row.Cells[9].Value.ToString());
                    lote = new Lote(-1, id, compra.IDCOMPRA, expiracion, cantidad, precioUnitario, costo, cantidadPaquete, cantidadEnPaquete);
                    this.listaLote.Add(lote);
                }
            }
        }
Exemple #17
0
        public async Task <IActionResult> PutLote([FromRoute] int id, [FromBody] Lote lote)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lote.IdLote)
            {
                return(BadRequest());
            }

            using (var sn = factory.OpenSession())
            {
                using (var tx = sn.BeginTransaction())
                {
                    try
                    {
                        sn.Delete(string.Format("FROM ItemLote WHERE IdLote = {0}", id));

                        foreach (var item in lote.Items)
                        {
                            item.IdLote = id;
                            sn.Save(item);
                        }

                        sn.SaveOrUpdate(lote);

                        await tx.CommitAsync();
                    }
                    catch (Exception ex)
                    {
                        await tx.RollbackAsync();

                        return(StatusCode(500, ex.Message));
                    }
                }
            }

            return(Ok(true));
        }
        private void ResetPDV()
        {
            venta            = new Venta();
            partidas         = new List <Ventap>();
            cliente          = null;
            producto         = null;
            SigPartida       = 0;
            datosCliente     = "PUBLICO EN GENERAL";
            TxtSubtotal.Text = "";
            TxtTotal.Text    = "";
            TxtCliente.Text  = "";

            ventaController    = new VentaController();
            ventapController   = new VentapController();
            productoController = new ProductoController();
            clienteController  = new ClienteController();

            ImpuestoController   = new ImpuestoController();
            empresaController    = new EmpresaController();
            loteController       = new LoteController();
            movInvController     = new MovInvController();
            flujoController      = new FlujoController();
            reporteController    = new ReporteController();
            dymErrorController   = new DymErrorController();
            formaPagoController  = new FormaPagoController();
            loteVentapController = new LoteVentapController();
            oCFDI = new CFDI();
            lote  = null;
            TxtProductoId.Focus();


            //Reset malla
            Malla.Rows.Clear();
            for (int i = 0; i < NPARTIDAS; i++)
            {
                Malla.Rows.Add();
                Malla.Rows[i].Cells[2].Style.BackColor = Color.Yellow;
                Malla.Rows[i].Cells[8].Style.BackColor = Color.Yellow;
            }
            CreaVenta();
        }
Exemple #19
0
        public void Deve_excluir_lote_caso_a_quantidade_do_pedido_for_maior()
        {
            var pedido = PedidoBuilder.Novo().ComQuantidade(10).Criar();

            _pedidos.Add(pedido);
            var comanda      = ComandaBuilder.Novo().ComPedidos(_pedidos).Criar();
            var primeiroLote = new Lote(pedido.Cerveja, 5);
            var segundoLote  = new Lote(pedido.Cerveja, 3);
            var terceiroLote = new Lote(pedido.Cerveja, 4);

            _lotes.Add(primeiroLote);
            _lotes.Add(segundoLote);
            _lotes.Add(terceiroLote);
            _repositorioDeLotes.Setup(repositorio => repositorio.ObterLotesPeloNomeDaCerveja(pedido.Cerveja.Nome))
            .Returns(_lotes);

            _realizacaoDaVenda.Vender(comanda);

            _repositorioDeLotes.Verify(repositorio => repositorio.Excluir(It.Is <Lote>(lote => lote == primeiroLote)));
            _repositorioDeLotes.Verify(repositorio => repositorio.Excluir(It.Is <Lote>(lote => lote == segundoLote)));
        }
        public void Executar(Lote lote)
        {
            var documentos = this.documentoRepositorio.ObterPorLoteComTipo(lote);

            foreach (var documento in documentos.Where(x => x.TipoDocumento.GrupoId > 0))
            {
                var tipoAnteriorId = documento.TipoDocumento.Id;
                var novoTipoId     = documento.TipoDocumento.GrupoId;

                if (tipoAnteriorId == novoTipoId)
                {
                    continue;
                }

                this.documentoRepositorio.AlterarTipo(documento.Id, novoTipoId);

                this.gravaLogDoDocumentoServico.Executar(LogDocumento.AcaoDocumentoGenerico,
                                                         documento.Id,
                                                         string.Format("Tipo Documento ajustado de [{0}] para [{1}]", tipoAnteriorId, novoTipoId));
            }
        }
Exemple #21
0
        public Lote Criar(string identificacao)
        {
            var pacote = this.pacoteFactory.Criar();

            Log.Application.Debug("Criando lote");

            var lote = new Lote
            {
                Identificacao      = identificacao,
                Pacote             = pacote,
                Status             = LoteStatus.AguardandoTransmissao,
                Batido             = "N",
                DataCriacao        = DateTime.Now,
                Agencia            = pacote.Estacao,
                PrioridadeNasFilas = "N",
                Grupo            = string.Format(@"{0:0000}", pacote.Estacao).Substring(3),
                PacoteProcessado = this.criaPacoteProcessado.Criar()
            };

            return(lote);
        }
Exemple #22
0
        private static void Init()
        {
            RService.Log(name + ": Começando o processamento... at {0}", logPath);

            try
            {
                //Inicializa as listas e variáveis que serão usadas pelo robô
                currentPage      = 1;
                lote             = LoteController.CreateLote(43, 1442);
                Cidades          = CidadeController.GetNameToCidade(Constants.TCEPI_UF);
                NameToOrgao      = OrgaoController.GetNomeUfToOrgao();
                NameToModalidade = ModalidadeController.GetNameToModalidade();
                alreadyInserted  = LicitacaoController.GetAlreadyInserted(1442, DateTime.Today.AddMonths(-3));

                GetLicitacoes();
            }
            catch (Exception e)
            {
                RService.Log("Exception (Init) " + name + ": " + e.Message + " / " + e.StackTrace + " / " + e.InnerException + " at {0}", logPath);
            }
        }
Exemple #23
0
        public Resultados <Lote> Filtrar(Lote filtrosListar, Paginacao paginacao)
        {
            try
            {
                Filtro <Lote>     filtro     = new Filtro <Lote>(filtrosListar, paginacao);
                Resultados <Lote> resultados = _da.Filtrar(filtro);

                if (resultados.Quantidade < 1)
                {
                    Validacao.Add(Mensagem.Padrao.NaoEncontrouRegistros);
                }

                return(resultados);
            }
            catch (Exception exc)
            {
                Validacao.AddErro(exc);
            }

            return(null);
        }
        private void Incializa()
        {
            tipoInventarioController = new TipoInventarioController();
            productoController       = new ProductoController();
            inventarioController     = new InventarioController();
            inventariopController    = new InventariopController();
            loteController           = new LoteController();
            movInvController         = new MovInvController();


            tipoInventario = null;
            producto       = null;
            lote           = null;
            inventario     = null;
            categoria      = null;
            partida        = null;
            Costo          = 0;
            partidas       = new List <Inventariop>();;
            CreaInventario();
            TxtTipoInv.Focus();
        }
Exemple #25
0
        private async void Salvar_Clicked(object sender, EventArgs e)
        {
            var lote = new Lote
            {
                Nome           = Nome.Text,
                Inseminacao    = Inseminacao.Text,
                Dieta          = Dieta.Text,
                Infraestrutura = Infraestrutura.Text
            };

            bool ret = db.GravaDados(lote);

            if (ret == true)
            {
                await DisplayAlert("Salvar", "Salvo com sucesso!", "OK");
            }
            else
            {
                await DisplayAlert("Salvar", "Erro na gravação dos dados!", "NOK");
            }
        }
        // GET: Alimentacao
        public ActionResult Index()
        {
            Lotes lotes = Lotes.List(Current.FazendaId);

            ViewBag.Lotes = new Lotes();
            if (lotes != null && lotes.Count > 0)
            {
                foreach (Lote l in lotes)
                {
                    if (Lote.GetQtnAnimais(l.Id) > 0)
                    {
                        ViewBag.Lotes.Add(l);
                    }
                }
            }
            if (ViewBag.Lotes.Count <= 0)
            {
                return(RedirectToAction("ApresentaMensagem", new { menssagem = "Não existe lotes com animais disponíveis", message = MessageType.Warning }));
            }
            return(View());
        }
Exemple #27
0
 public Boolean CadastrarLote(Lote obj)
 {
     if (obj.Item != null || obj.Fornecedor != null)
     {
         LoteDAO dao = new LoteDAO();
         if (obj.Id != 0)
         {
             dao.update(obj);
             historico(obj, "UPDATE");
             return(true);
         }
         else
         {
             obj.DataEntrada = DateTime.Now;
             dao.insert(obj);
             historico(LoteDAO.findByCode(obj.Codigo), "INSERT");
             return(true);
         }
     }
     return(false);
 }
Exemple #28
0
        public async Task <IActionResult> Edit(int id, [Bind("IdLote,CodigoLote,DataInicio,DataFim,Observacoes,RegNovosAnimaisIdRegAnimal,FuncionarioIdFuncionario")] Lote lote)
        {
            if (id != lote.IdLote)
            {
                return(NotFound());
            }

            //validation
            var val_code = await _context.Lote
                           .SingleOrDefaultAsync(m => m.CodigoLote == lote.CodigoLote);

            if (val_code != null && val_code.IdLote != lote.IdLote)
            {
                ModelState.AddModelError("CodigoLote", string.Format("Já existe um lote com o código {0}.", lote.CodigoLote));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lote);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoteExists(lote.IdLote))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FuncionarioIdFuncionario"]   = new SelectList(_context.Funcionario, "IdFuncionario", "NomeCompleto", lote.FuncionarioIdFuncionario);
            ViewData["RegNovosAnimaisIdRegAnimal"] = new SelectList(_context.RegNovosAnimais, "IdRegAnimal", "RespTransporte", lote.RegNovosAnimaisIdRegAnimal);
            return(View(lote));
        }
Exemple #29
0
        public Lote PesquisarLoteIndice(int lngIndice)
        {
            try
            {
                AbrirConexao();
                strSQL = "Select * from [VW_LOTE] Where CD_INDEX = @v1";
                Cmd    = new SqlCommand(strSQL, Con);
                Cmd.Parameters.AddWithValue("@v1", lngIndice);

                Dr = Cmd.ExecuteReader();

                Lote p = null;

                if (Dr.Read())
                {
                    p = new Lote();

                    p.CodigoIndice   = Convert.ToInt32(Dr["CD_INDEX"]);
                    p.CodigoEmpresa  = Convert.ToInt32(Dr["CD_EMPRESA"]);
                    p.CodigoProduto  = Convert.ToInt32(Dr["CD_PRODUTO"]);
                    p.CodigoSituacao = Convert.ToInt32(Dr["CD_SITUACAO"]);
                    p.NumeroLote     = Convert.ToString(Dr["NR_LOTE"]);
                    p.SerieLote      = Convert.ToString(Dr["SR_LOTE"]);
                    p.DataValidade   = Convert.ToDateTime(Dr["DT_VALIDADE"]);
                    p.DataFabricacao = Convert.ToDateTime(Dr["DT_FABRICACAO"]);
                    p.QuantidadeLote = Convert.ToDecimal(Dr["QT_LOTE"]);
                    p.Cpl_DescDDL    = "LT: " + p.NumeroLote.ToString() + " - DFAB: " + p.DataFabricacao.ToString("dd/MM/yyyy") + " - DVAL: " + p.DataValidade.ToString("dd/MM/yyyy");
                }

                return(p);
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao Pesquisar Lote: " + ex.Message.ToString());
            }
            finally
            {
                FecharConexao();
            }
        }
Exemple #30
0
        public List <Lote> ListarLoteDisponivel(int intNomeEmpresa, int intNomeProtuto, int intCodSituacao)
        {
            try
            {
                AbrirConexao();

                string strSQL = "select * from [VW_LOTE] where CD_EMPRESA = @v1 and CD_PRODUTO = @v2 and CD_SITUACAO = @v3";

                Cmd = new SqlCommand(strSQL, Con);
                Cmd.Parameters.AddWithValue("@v1", intNomeEmpresa);
                Cmd.Parameters.AddWithValue("@v2", intNomeProtuto);
                Cmd.Parameters.AddWithValue("@v3", intCodSituacao);

                Dr = Cmd.ExecuteReader();

                List <Lote> lista = new List <Lote>();
                while (Dr.Read())
                {
                    Lote p = new Lote();
                    p.CodigoIndice   = Convert.ToInt32(Dr["CD_INDEX"]);
                    p.NumeroLote     = Convert.ToString(Dr["NR_LOTE"]);
                    p.DataValidade   = Convert.ToDateTime(Dr["DT_VALIDADE"]);
                    p.DataFabricacao = Convert.ToDateTime(Dr["DT_FABRICACAO"]);

                    p.Cpl_DescDDL = "LT: " + p.NumeroLote.ToString() + " - DFAB: " + p.DataFabricacao.ToString("dd/MM/yyyy") + " - DVAL: " + p.DataValidade.ToString("dd/MM/yyyy");


                    lista.Add(p);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao Listar Lote: " + ex.Message.ToString());
            }
            finally
            {
                FecharConexao();
            }
        }
Exemple #31
0
        public Lote insert(Lote lote)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "INSERT INTO Lote(tipo_estoque, validade, peso_kg, valor_compra, qtd_estoque, fk_item, fk_fornecedor, data_entrada, data_fabricacao, codigo) output INSERTED.id " +
                              "values (@tipo_estoque, @dias_validade, @peso_kg, @valor_compra, @qtd_estoque, @fk_item, @fk_fornecedor, @data_entrada, @data_fabricacao, @codigo)";
            cmd.Parameters.AddWithValue("@tipo_estoque", lote.Tipo_estoque);
            cmd.Parameters.AddWithValue("@dias_validade", lote.Dias_validade);
            cmd.Parameters.AddWithValue("@peso_kg", lote.Peso_kg);
            cmd.Parameters.AddWithValue("@valor_compra", lote.Valor_compra);
            cmd.Parameters.AddWithValue("@qtd_estoque", lote.Qtd_estoque);
            cmd.Parameters.AddWithValue("@fk_item", lote.Item.Id);
            cmd.Parameters.AddWithValue("@fk_fornecedor", lote.Fornecedor.Id);
            cmd.Parameters.AddWithValue("@data_entrada", lote.DataEntrada);
            cmd.Parameters.AddWithValue("@data_fabricacao", lote.DataFabricacao);
            cmd.Parameters.AddWithValue("@codigo", lote.Codigo);
            if (Conexao.CRUD(cmd))
            {
                return(lote);
            }
            return(null);
        }
        //Cuando selecciona un medicamento del codigo completa los datos del lote para llenar el combo
        protected void completarDatosLote(object sender, EventArgs e)
        {
            String usarL = ddl_lotes.SelectedValue;
            lote = iLote.getByCriterio<Lote>("", "", usarL).First<Lote>();
            txt_FechaVto.Text = Convert.ToString(lote.fechaVto);
            txt_FechElab.Text = Convert.ToString(lote.fechaElaboracion);
            txt_lote1.Text = Convert.ToString(lote.nroLote);
            bt_cancel.Visible = true;
            bt_Nuevo.Visible = true;


        }
 public void AddToLote(Lote lote)
 {
     base.AddObject("Lote", lote);
 }
 public static Lote CreateLote(int id)
 {
     Lote lote = new Lote();
     lote.Id = id;
     return lote;
 }
        //Cuando selecciona un lote completa los datos del lote y calcula la cantidad de stock disponible para ese lote
        protected void completarDatosLote(object sender, EventArgs e)
        {
            int stkLote=0;
            int usarM = 0;
            String usarL = ddl_lotes.SelectedValue;
            lote = iLote.getByCriterio<Lote>("", "", usarL).First<Lote>();
            txt_FechaVto.Text = Convert.ToString(lote.fechaVto);
            txt_FechElab.Text = Convert.ToString(lote.fechaElaboracion);
            txt_lote1.Text = Convert.ToString(lote.nroLote);
            usarM = Convert.ToInt32(txt_codigoMed.Text);
            listaStkM = iStockM.getCriterioById<StockMedicamento>("", "", usarM);

            //calcula la cantidad de stock para el lote
            foreach (StockMedicamento stk in listaStkM)
            {
               if (stk.lote == lote.nroLote && stk.fechaBaja == null)
               {
                 stkLote = stkLote + Convert.ToInt32(stk.stockActual);
               }
            }
            txt_stockLote.Text = Convert.ToString(stkLote);
        }