Beispiel #1
0
  private LinkedHashMap<Material, List<Integer>> calculateStockForNextPeriods() {
    LinkedHashMap<Material, List<Integer>> stockNextPeriodsWithMat =
        new LinkedHashMap<Material, List<Integer>>();
    Repository repo = Repository.getInstance();

    for (Material mat : needs.keySet()) {
      List<Integer> stockNextPeriods = new ArrayList<>();
      Integer amountThisPeriod =
          dbch.findMaterial(mat.getId()).getAmount() + repo.getArrivalAmountOfMaterial(mat, 1);
      // Errechneter Bestand Planperiode
      stockNextPeriods.add(amountThisPeriod - needs.get(mat).get(0));
      // Errechneter Bestand Planperiode + 1
      stockNextPeriods.add(
          stockNextPeriods.get(0)
              - needs.get(mat).get(1)
              + repo.getArrivalAmountOfMaterial(mat, 2));
      // Errechneter Bestand Planperiode + 2
      stockNextPeriods.add(
          stockNextPeriods.get(1)
              - needs.get(mat).get(2)
              + repo.getArrivalAmountOfMaterial(mat, 3));
      // Errechneter Bestand Planperiode + 3
      stockNextPeriods.add(
          stockNextPeriods.get(2)
              - needs.get(mat).get(3)
              + repo.getArrivalAmountOfMaterial(mat, 4));

      stockNextPeriodsWithMat.put(mat, stockNextPeriods);
    }

    return stockNextPeriodsWithMat;
  }
Beispiel #2
0
  private Integer roundDeliveryPeriodFloor(Material mat) {
    Repository repo = Repository.getInstance();
    PeriodDate date = mat.getDeliveryTime().add(mat.getDeliveryAberation(), repo.getRiskPercente());

    if (date.getDay() < 6) {
      return date.getPeriod();
    } else {
      return (date.getPeriod() + 1);
    }
  }
Beispiel #3
0
  private LinkedHashMap<Material, Double> calculateCoverage() {
    LinkedHashMap<Material, Double> coverage = new LinkedHashMap<Material, Double>();

    for (Material mat : needs.keySet()) {
      Repository repo = Repository.getInstance();
      // Menge im Lager + Menge die in der Planperiode kommt
      Integer AmountThisPeriod =
          dbch.findMaterial(mat.getId()).getAmount() + repo.getArrivalAmountOfMaterial(mat, 1);
      // Menge in dieser Periode / Durchschnittsverbrauch
      Double value = AmountThisPeriod / averageNeeds.get(mat);
      coverage.put(mat, value);
    }

    return coverage;
  }
Beispiel #4
0
  private Order calculateOrderSize(Material mat) {
    Integer resultAmount = null;
    Mode resultMode = null;

    if (newOrderRequired(mat)) {
      Mode mode = chooseOrderMode(mat);
      Integer roundDeliveryPeriod = 0;
      switch (mode) {
        case NORMAL:
          roundDeliveryPeriod = roundDeliveryPeriodFloor(mat);
          resultMode = Mode.NORMAL;
          break;

        case EIL:
          roundDeliveryPeriod = (int) (mat.getDeliveryTime().half().getPeriod());
          resultMode = Mode.EIL;
          break;
      }
      resultAmount =
          (int) (timeMaterialCoverage.get(mat) - calculatedStock.get(mat).get(roundDeliveryPeriod));
    }
    Order result = new Order();
    result.setMaterial(mat);
    if (resultAmount != null && resultMode != null) {
      result.setAmount(resultAmount);
      result.setMode(resultMode.getMark());
    }
    return result;
  }