def buscar(self, boton):
     """
     """
     idproducto = utils.combo_get_value(self.wids["cmbe_producto"])
     if idproducto == None:
         utils.dialogo_info(titulo="ERROR", texto="Seleccione un producto", padre=self.wids["ventana"])
         return
     producto = pclases.ProductoVenta.get(idproducto)
     and_fecha_inicio = "AND parte_de_produccion.fecha >= '%s'" % (self.get_unambiguous_fecha(self.inicio))
     if producto.es_rollo():
         parte_where_de_consulta = """
 partida.id IN 
     (SELECT rollo.partida_id 
      FROM rollo 
      WHERE rollo.id IN 
         (SELECT articulo.rollo_id 
          FROM articulo 
          WHERE articulo.producto_venta_id = %d AND articulo.parte_de_produccion_id IN 
             (SELECT parte_de_produccion.id 
              FROM parte_de_produccion 
              WHERE parte_de_produccion.fecha <= '%s' %s
              ORDER BY parte_de_produccion.fecha
             )
         )
     ) """ % (
             producto.id,
             self.get_unambiguous_fecha(self.fin),
             self.inicio and and_fecha_inicio or "",
         )
     else:
         parte_where_de_consulta = """
 partida.id IN 
     (SELECT bala.partida_carga_id 
      FROM bala 
      WHERE bala.id IN 
         (SELECT articulo.rollo_id 
          FROM articulo 
          WHERE articulo.producto_venta_id = %d AND articulo.parte_de_produccion_id IN 
             (SELECT parte_de_produccion.id 
              FROM parte_de_produccion 
              WHERE parte_de_produccion.fecha <= '%s' %s
              ORDER BY parte_de_produccion.fecha
             )
         )
     ) """ % (
             producto.id,
             self.get_unambiguous_fecha(self.fin),
             self.inicio and and_fecha_inicio or "",
         )
     partidas = pclases.Partida.select(parte_where_de_consulta, distinct=True)
     # Hasta aquí la consulta optimizada para obtener las partidas. Pasamos a recuperar los datos en sí:
     vpro = VentanaActividad(padre=self.wids["ventana"])
     vpro.mostrar()
     self.resultado = []
     for p in partidas:
         vpro.mover()
         self.resultado.append(p)
     vpro.ocultar()
     self.resultado = partidas
     self.rellenar_tabla(self.resultado)
 def buscar(self,boton):
     """
     """
     idproducto = utils.combo_get_value(self.wids['cmbe_producto'])
     if idproducto == None:
         utils.dialogo_info(titulo = 'ERROR', texto = 'Seleccione un producto', padre = self.wids['ventana'])
         return
     producto = pclases.ProductoVenta.get(idproducto)
     and_fecha_inicio = "AND parte_de_produccion.fecha >= '%s'" % (self.get_unambiguous_fecha(self.inicio))
     if producto.es_rollo():     # No debería ocurrir. Lo mantengo porque es copy-paste de la consulta de partidas.
         parte_where_de_consulta = """
 partida.id IN 
     (SELECT rollo.partida_id 
      FROM rollo 
      WHERE rollo.id IN 
         (SELECT articulo.rollo_id 
          FROM articulo 
          WHERE articulo.producto_venta_id = %d AND articulo.parte_de_produccion_id IN 
             (SELECT parte_de_produccion.id 
              FROM parte_de_produccion 
              WHERE parte_de_produccion.fecha <= '%s' %s
              ORDER BY parte_de_produccion.fecha
             )
         )
     ) """ %(producto.id, 
             self.get_unambiguous_fecha(self.fin), 
             self.inicio and and_fecha_inicio or "")
     else:
         parte_where_de_consulta = """
 lote.id IN 
     (SELECT bala.lote_id 
      FROM bala 
      WHERE bala.id IN 
         (SELECT articulo.bala_id 
          FROM articulo 
          WHERE articulo.producto_venta_id = %d AND articulo.parte_de_produccion_id IN 
             (SELECT parte_de_produccion.id 
              FROM parte_de_produccion 
              WHERE parte_de_produccion.fecha <= '%s' %s
              ORDER BY parte_de_produccion.fecha
             )
         )
     ) """ %(producto.id, 
             self.get_unambiguous_fecha(self.fin), 
             self.inicio and and_fecha_inicio or "")
     lotes = pclases.Lote.select(parte_where_de_consulta, distinct = True)
     # Hasta aquí la consulta optimizada para obtener los lotes. Pasamos a recuperar los datos en sí:
     vpro = VentanaActividad(padre = self.wids['ventana'])
     vpro.mostrar()
     self.resultado = []
     for p in lotes:
         vpro.mover()
         self.resultado.append(p)
     vpro.ocultar()
     self.resultado = lotes
     self.rellenar_tabla(self.resultado)
示例#3
0
    def copia_remota(self, rutacompleta):
        # Copia del .mdb a un directorio temporal en el servidor GNU/Linux.
        self.add_salida('Copiando fichero %s...\n' % (rutacompleta))
        # Ventana de actividad: ---8<---
        self.seguir = True
        vprogreso = VentanaActividad(texto = 'Creando copia remota...\n(Esta operación puede tomar algún tiempo.)', padre = self.wids['ventana'])
        self.wids['ventana'].window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
        while gtk.events_pending(): gtk.main_iteration(False)
        vprogreso.mostrar()
        vprogreso.mover()
#        gobject.idle_add(self._actualizar, vprogreso, priority = gobject.PRIORITY_LOW)
#        self._actualizar(vprogreso)
#        while gtk.events_pending(): gtk.main_iteration(False)
        # ------------------------->8---
        sesion = SshSession(host = self.CONFIG['host'], user = self.CONFIG['user'], password = self.CONFIG['password'])
        sesion.scp(src = rutacompleta, dest = self.CONFIG['dir_destino'])
        # -------------------------8<---
        vprogreso.mover()
        self.seguir = False
        vprogreso.ocultar()
        # ------------------------->8---
        self.wids['ventana'].window.set_cursor(None)
示例#4
0
        pclases.AlbaranSalida.q.fecha < mx.DateTime.DateTime(2008, 1, 1)))
        # Los anteriores a 2008 tampoco se pueden tocar ya a estas alturas.
    vpro.mover()
    TICKETS_A_IGNORAR = []
    vpro.mover()
else:
    vpro.mover()
    PEDIDOS_ALBARANES_Y_FACTURAS_A_IGNORAR_MISMO_C_O_P = []
    IGNORADOS_SIN_PROVEEDOR_O_CLIENTE = []
    ARTICULOS_A_IGNORAR = []
    PARTES_A_IGNORAR = []
    ALBARANES_A_IGNORAR = []
    TICKETS_A_IGNORAR = tuple(pclases.Ticket.select(
        pclases.Ticket.q.fechahora < mx.DateTime.DateTimeFrom(2008, 1, 1)))
    vpro.mover()
vpro.ocultar()
del(vpro)

class Test(Thread):
    def __init__ (self, button, count, active_threads):
        Thread.__init__(self)
        self.count = count
        self.button = button
        self.active_threads = active_threads

    def run(self):
        gtk.gdk.threads_enter()
        self.active_threads.append(self)  # La lista de hilos DEL HILO PRINCIPAL del proceso. La bloqueo y desbloqueo cada vez que la toco.
        gtk.gdk.threads_leave()
        for i in range(0, 10):
            time.sleep(1)