예제 #1
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;
  }
예제 #2
0
 public List<Order> ordering() {
   List<Order> result = new ArrayList<>();
   for (Material mat : purchaseGoods) {
     Order newOrder = calculateOrderSize(mat);
     if (newOrder.getAmount() > 10) {
       result.add(newOrder);
     }
   }
   return result;
 }