public static cestatotais RetornaTotaisCesta(string codped, string datasource, string schema) { using (OracleConnection con = new OracleConnection(Util.OracleHelper.StrConn(schema, datasource))) { con.Open(); cestatotais cestatot = new cestatotais(); StringBuilder query = new StringBuilder(); query.AppendLine(" select codped,sum(vrcontabil) vrtotal, sum(quantidade) qtdetotal, sum(nvl(pw.nrpeso,0) * quantidade )/1000 as peso from tmp_cesta tmp, prodweb pw "); query.AppendLine(" where tmp.codproduto = pw.cdproduto and tmp.codped=" + codped); query.AppendLine(" group by codped"); using (OracleCommand cm1 = new OracleCommand(query.ToString(), con)) { using (OracleDataReader dr = cm1.ExecuteReader()) { while (dr.Read()) { cestatot.idpedido = dr["codped"].ToString(); //cestatot.codproduto = dr["codproduto"].ToString(); cestatot.vrtotalpedido = Convert.ToDouble(dr["vrtotal"].ToString()); cestatot.totalitens = Convert.ToDouble(dr["qtdetotal"].ToString()); cestatot.pesototal = Convert.ToDouble(dr["peso"].ToString()); } } } return(cestatot); } }
public static AxadoCotacoes RetornaTabelaCotacao(string cdcesta, string cepcliente, string datasource, string schema, out string pjsonretorno) { cestatotais lstcesta = CestaADO.RetornaTotaisCesta(cdcesta, datasource, schema); AxadoPost apv = new AxadoPost(); apv.cep_destino = cepcliente; apv.cep_origem = ConfigurationManager.AppSettings.Get("AXADO_CEPORIGEM"); apv.valor_notafiscal = lstcesta.vrtotalpedido.ToString("N2"); //apv.prazo_adicional = ""; //apv.preco_adicional = ""; AxadoPostVolume apvv = new AxadoPostVolume(); apvv.altura = "1"; apvv.comprimento = "1"; apvv.largura = "1"; apvv.peso = lstcesta.pesototal.ToString("N2"); apvv.preco = lstcesta.vrtotalpedido.ToString("N2"); apvv.quantidade = lstcesta.totalitens.ToString(); apvv.sku = "PED" + lstcesta.idpedido; //logparametro = "Peso: " + pPesoTotal.ToString("N2") + " valor total: " + pVrTotalPedido.ToString("N2"); apv.volumes.Add(apvv); string jsoonenvio = string.Empty; string jsonRetorno = string.Empty; AxadoCotacoes axc = Axado.GetTabelaFrete(apv, out jsoonenvio, out jsonRetorno); pjsonretorno = jsonRetorno; //logparametro = logparametro + " JSON: " + jsoonenvio; return(axc); }