Example #1
0
  // <editor-fold defaultstate="collapsed" desc="Load de Pantalla" >
  @PostConstruct
  public void initForm() {

    if (AdminEJBService == null) {
      AdminEJBService = new AdminEJBClient();
    }

    if (inventoryEJB == null) {
      inventoryEJB = new InventoryEJBClient();
    }

    if (AccountingEJBClient == null) {
      AccountingEJBClient = new AccountingEJBClient();
    }
    // llenar los almacenes en combobox
    String var = null;
    try {
      this.setListaAlmacenes((List<BranchTO>) AdminEJBService.getBranch(var, var));

    } catch (Exception e) {
      faceMessage(e.getMessage() + " -" + e.getCause());
      System.out.println(e.getMessage() + " -" + e.getCause());
    }

    // estado por defecto
    estateGuardar();
  }
Example #2
0
 // <editor-fold defaultstate="collapsed" desc="Evento al seleccionar del ComboBox de almacenes" >
 public void stateChangeListener(ValueChangeEvent event) {
   System.out.print(event.getNewValue().toString());
   if (event.getNewValue() != almDest) {
     try {
       List _result = null;
       String var = null;
       _result = AdminEJBService.getBranch(event.getNewValue().toString(), var);
       Iterator<BranchTO> iterator = _result.iterator();
       BranchTO articulo = (BranchTO) iterator.next();
       nomAlmacen = articulo.getWhsname();
     } catch (Exception ex) {
       Logger.getLogger(GoodsIssuesBean.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
Example #3
0
  public List<String> completeCode(String query) {
    List _result = null;
    String var = null;

    ArticlesInTO in = new ArticlesInTO();
    in.setItemCode(query);
    in.setItemName(var);

    try {
      _result = AdminEJBService.getArticles(in);

    } catch (Exception e) {
    }

    List<String> results = new ArrayList<String>();

    Iterator<ArticlesTO> iterator = _result.iterator();

    while (iterator.hasNext()) {
      ArticlesTO articulo = (ArticlesTO) iterator.next();
      results.add(articulo.getItemCode());
    }
    return results;
  }
Example #4
0
  // <editor-fold defaultstate="collapsed" desc="Evento al seleccionar del autocomplete" >
  public void findArticle(SelectEvent event) {
    List articulos = new Vector();
    String var = null;

    // Partir codigo, y quitar el codigo viejo
    newNomArt =
        StringUtils.isBlank(newNomArt)
            ? newNomArt
            : newNomArt.substring(0, newNomArt.lastIndexOf("»") - 1);

    ArticlesInTO in = new ArticlesInTO();
    in.setItemCode(newCod);
    in.setItemName(newNomArt);

    if (event.getObject().toString() != var) {
      List _result = null;

      try {
        _result = AdminEJBService.getArticles(in);

      } catch (Exception e) {
        faceMessage(e.getMessage() + " -- " + e.getCause());
        newCod = null;
        newNomArt = null;
      }
      if (_result.isEmpty()) {
        this.newCod = null;
        this.newNomArt = null;

      } else {
        Iterator<ArticlesTO> iterator = _result.iterator();
        while (iterator.hasNext()) {
          ArticlesTO articulo = (ArticlesTO) iterator.next();
          articulos.add(articulo);
        }
        if (articulos.size() == 1) {
          try {
            System.out.println("articulo unico, llenar campos en pantalla");
            ArticlesTO art = (ArticlesTO) articulos.get(0);
            newNomArt = art.getItemName();
            newCod = art.getItemCode();
            newUnidad = art.getBuyUnitMsr();
            newExistencia = art.getOnHand();
            newCostoPromedio = art.getAvgPrice();
            art = AdminEJBService.getArticlesByKey(newCod);
            if (almDest != "-1") {
              List alm = art.getBranchArticles();
              Iterator<BranchArticlesTO> iter = alm.iterator();
              while (iter.hasNext()) {
                BranchArticlesTO branch = (BranchArticlesTO) iter.next();
                if (branch.getWhscode().equals(almDest)) {
                  newExistencia = branch.getOnhand();
                  break;
                }
              }
            }
          } catch (Exception ex) {
            Logger.getLogger(GoodsIssuesBean.class.getName()).log(Level.SEVERE, null, ex);
          }
        } else {

          for (Object artt : articulos) {
            ArticlesTO art = (ArticlesTO) artt;
            if (newNomArt.equals(art.getItemName())) {
              newNomArt = art.getItemName();
              newCod = art.getItemCode();
              newUnidad = art.getBuyUnitMsr();
            }
          } // cierre for
        } // cierre else
      }
    }
  }