コード例 #1
0
  public List<Worker> getForeman() {
    List<Worker> unBusy = new ArrayList<Worker>();

    WorkerDAO wdao = daof.getWorkerDAO();
    WorkerRequestDAO wrdao = daof.getWorkerRequestDAO();
    ProfessionDAO profession = daof.getProfessionDAO();
    RequestEntityDAO redao = daof.getRequestEntityDAO();
    Profession frmn = profession.getProfession(1);
    List<Worker> formans = wdao.getWorkerByProfession(frmn);
    boolean isBusyForeman = false;
    for (int j = 0; j < formans.size(); j++) {
      if (formans.get(j).isBusy()) {
        List<Integer> idreqs = wrdao.getListRequest(formans.get(j).getIdworker());
        for (int ii = 0; ii < idreqs.size(); ii++) {
          RequestEntity re = redao.getRequest(idreqs.get(ii));
          if (getCurrentRequest().getOrderFullfillment().equals(re.getOrderFullfillment())) {
            isBusyForeman = true;
            break;
          }
        }
      }
      if (!isBusyForeman) {
        unBusy.add(formans.get(j));
      }
      isBusyForeman = false;
    }

    return unBusy;
  }
コード例 #2
0
  public List<Worker> getWorkers() {
    List<Worker> unBusy = new ArrayList<Worker>();

    WorkerDAO wdao = daof.getWorkerDAO();
    Profession cprof = getCurrentRequest().getTypeWork().getWhoDo();
    List<Worker> workers = wdao.getWorkerByProfession(cprof);
    WorkerRequestDAO wrdao = daof.getWorkerRequestDAO();
    RequestEntityDAO redao = daof.getRequestEntityDAO();
    Boolean isBusy = false;
    for (int j = 0; j < workers.size(); j++) {
      if (workers.get(j).isBusy()) {
        List<Integer> idreqs = wrdao.getListRequest(workers.get(j).getIdworker());
        for (int ii = 0; ii < idreqs.size(); ii++) {
          RequestEntity re = redao.getRequest(idreqs.get(ii));
          if (getCurrentRequest().getOrderFullfillment().equals(re.getOrderFullfillment())) {
            isBusy = true;
            break;
          }
        }
      }
      if (!isBusy) {
        unBusy.add(workers.get(j));
      }
      isBusy = false;
    }

    return unBusy;
  }