예제 #1
0
        private void ImportaDados(String transacaoPedido, DateTime dataFiltro)
        {
            var transacaoPedidoRb = setAndGetSequence();

            //Set the main header.
            Cabecalho cabecalho = new Cabecalho();

            cabecalho.dateImport = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            cabecalho.dateFech   = dataFiltro.ToString("yyyy-MM-dd");

            cabecalho.transRequest = transacaoPedido;
            cabecalho.importSeq    = transacaoPedidoRb;
            cabecalho.status       = "N";


            String codVendedorAtualPR = BancoPadaria.obterCodigoVendedor(transacaoPedido);

            var relacaoVendedores = BancoFechamento.getVendedores();

            String codVendedorFrassini = relacaoVendedores[codVendedorAtualPR];

            VerificaFechamento(codVendedorFrassini, cabecalho.dateFech);

            cabecalho.vendCod = codVendedorFrassini;

            var detalhesGeral = carregarDadosPadaria(transacaoPedido, dataFiltro);

            setProdCodFrass(ref detalhesGeral);

            //var produtosFechamento = setDet(detalhesGeral, transacaoPedido);

            String manifestoFr = "";

            carregarDadosFrassini(transacaoPedido, dataFiltro, detalhesGeral, cabecalho.vendCod, out manifestoFr);
            cabecalho.transManifest = manifestoFr;


            var comuns = detalhesGeral.Where(t => t.prodCodigo > 0 && t.prodCodigoRB > 0);

            setTableDets(detalhesGeral, cabecalho);
        }
예제 #2
0
        //Get the requests where the doct code = 7505.
        public static List <String> getRequests(FiltroRelatorio filtro)
        {
            AbrirConexao();



            List <String> where = new List <String>();


            if (filtro.DateManifesto != null)
            {
                //"yyyy-MM-dd" is the format of the date.
                where.Add($"  pvec_database = '{filtro.DateManifesto.ToString("yyyy-MM-dd")}' ");
            }


            where.Add(" mdoc_status = 'N' ");
            where.Add(" mdoc_dcto_codigo = '7505' ");
            var vendedor = BancoFechamento.getVendedores();

            var sqlVendedor = vendedor.Select(t => t.Key).ToList().JoinArraySQL();

            where.Add($" pvec_vend_codigo in ({sqlVendedor})");

            //Get the tables in postgresql.

            //Get the requests.
            String sql = $" select mdoc_transacao, pvec_vend_codigo, pvec_database from movdctos " +
                         " inner join pedvendac on mdoc_transacao = pvec_transacao ";



            if (where.Count > 0)
            {
                sql += " where ";
            }


            for (int i = 0; i < where.Count; i++)
            {
                sql += " " + where[i];
                if (i != where.Count - 1)
                {
                    sql += " and ";
                }
            }

            //Get the requests and find the manifest.

            var cmd = new NpgsqlCommand(sql, mConexao);
            var dr  = cmd.ExecuteReader();

            List <String> infos = new List <String>();

            //String requestTransation;

            while (dr.Read())
            {
                infos.Add(dr.GetSafeValue <String>("mdoc_transacao"));
            }


            dr.Close();

            return(infos);
        }