Problem with SQL FIREBIRD

I am trying to send the requests to the database, but there is the problem of “deadlock”, ie the queries are running at the same time and are not sending all the requests because it gives error, does anyone have a solution for this? If you see Ryu in the code, I’m sorry …

public enviarUnico(pedido){
       this.database.listaPedidoUnico(pedido)
       .then(
           (data) => {
               if(data[0].status != "Enviado"){
                    this.database.enviaPedidoUnico(pedido)
                    .then(
                        (data) => {           
                            if (data != 'nenhum'){
                                let pedido = data;
                                this.webservice.enviaOrcamentoOffline(pedido, this.servidor)
                                .then(
                                    (data) => {
                                        this.database.atualizaPedidos(pedido[0].num_pedido)
                                        .then(
                                            (data) => {
                                                this.listaPedidos();
                                                this.database.presentToastBottom("Orçamento enviado com sucesso!");
                                            },
                                            (error) => {
                                                this.database.presentToastError(JSON.stringify(error));
                                            }
                                        )
                                    },
                                    (error) => {
                                        this.database.presentToastError(JSON.stringify(error))
                                    }
                                )
                            } else {
                                this.database.presentToastError("Orçamento: "+data[0].num_pedido+" não encontrado!")
                            }
                        },
                        (error) => {
                            this.database.presentToastError(JSON.stringify(error));
                        }
                    )
               }else{
                   this.database.presentToast("Orçamento já enviado!");
               }
           }
        )
    }
enviaOrcamentoOffline(pedido, servidor){
    this.urlServidor = 'http://'+servidor+'/servidor/';
    return this.http.post(this.urlServidor+'orcamentooffline',pedido,{headers:this.headers})
    .toPromise()
    .then(res => res.json());
  }