0
  private CTomatic(orders: Array<Order>): void {
const Ct = Number(window.localStorage.getItem('defaultCookingTime'));
if (orders.length > 0) {
  orders.forEach(order => {
    if (
      order.partner_order_state === ORDER_STATE.NEWORDER &&
      (window.localStorage.getItem('cookingTime') === 'true' ? true : false)
    ) {
      this.ordersService
      .takeOrder(order.id, this.cookingTime(order, Ct))
      .retry(5)
      .subscribe(
        result => {
          this.autoPrinter();
          this.autoupdatethatshit();
        },
        (err: HttpErrorResponse) => {
          const error = err.error ? err.error.error.message : err.statusText;
          this.snackbarService.showMessageSnackbar(error);
          this.autoupdatethatshit();
        }
      );
    }
  });
}

}

my bug is that when i reach to this.autoPrinter(); they should print a text that is working fine, i think that the problem is on the observable but im stuck on that dont know if is something else i really need help on that !!!

tengo un problema en mi metodo Ctomaic que dentro del subscribe cuando ya tiene la data y se dispara la funcion de imprimir this.autoPrinter(), la impresion sale en blanco, no entiendo por que si la data llega bien al metodo hace lo que tiene que hacer solo que no imprime nada solo la hoja en blanco

public autoPrinter(): void {
if (this.notificationPrintIsEnable === true) {
  window.setTimeout(() => this.printerService.print(), 2000);
}

}

  public autoupdatethatshit(): void {
setTimeout(() => {
  this.ordersService.getOrders();
}, 5000);

}

//en el metodo de abajo imprime la data bien y son bastante parecidos

public takingOrder() {
if (!this.disabled) {
  this.disabled = true;
  this.showLoading.emit(true);
  this.ordersService
    .takeOrder(this.orderDetail.id, this.cookingTime)
    .subscribe(
      result => {
        this.takeOrderEvent.emit({
          id: this.orderDetail.id,
          cooking_time: this.cookingTime
        });
        this.disabled = false;
        this.showLoading.emit(false);
        this.orderAccept.emit();
        this.autoPrinter();
      },
      (err: HttpErrorResponse) => {
        this.showLoading.emit(false);
        const error = err.error ? err.error.error.message : err.statusText;
        this.disabled = false;
        this.snackbarService.showMessageSnackbar(error);
        this.orderAccept.emit();
      }
    );
}

}

4
  • edita tu pregunta, traducelo porfavor!, este es el sitio de SO en idioma español el 11 may. 2019 a las 4:52
  • listo, gracias por el comentario !
    – andres
    el 11 may. 2019 a las 4:58
  • 1
    Andres traduce toda tu pregunta, el titulo incluido. Si no es muy probable que tengamos que cerrarla.
    – gbianchi
    el 11 may. 2019 a las 5:02
  • 1
    Bienvenido a Stack Overflow en español! Mira Cómo preguntar para que tu pregunta sea mejor recibida. También, aprovecha y haz el recorrido de bienvenida para entender mejor cómo funcionamos y de paso obtener tu primera medalla!
    – gbianchi
    el 11 may. 2019 a las 5:02

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.