예제 #1
0
  public ShipmentCandidates(final Map<Integer, I_C_OrderLine> myOrderLineCache) {
    orderLineCache = new HashMap<Integer, MOrderLine>();

    for (final Integer orderLineId : myOrderLineCache.keySet()) {
      final I_C_OrderLine orderLine = myOrderLineCache.get(orderLineId);
      final MOrderLine orderLinePO = InterfaceWrapperHelper.getPO(orderLine);
      orderLineCache.put(orderLineId, orderLinePO);
    }
  }
예제 #2
0
 private MInOutLine getPO(final I_M_InOutLine inOutLine) {
   return InterfaceWrapperHelper.getPO(inOutLine);
 }
예제 #3
0
  @Override
  public void addLine(
      final I_M_InOut inOut,
      final I_M_InOutLine inOutLine,
      final I_M_ShipmentSchedule sched,
      final CompleteStatus completeStatus,
      final I_C_Order order) {
    Check.assumeNotNull(inOut, "inOut not null");
    Check.assumeNotNull(inOutLine, "inOutLine not null");
    Check.assumeNotNull(sched, "sched not null");
    Check.assumeNotNull(completeStatus, "completeStatus not null");

    if (!orderedCandidates.contains(inOut)) {
      throw new IllegalStateException(
          "inOut needs to be added using 'addInOut' first"
              + "\n InOut: "
              + inOut
              + "\n orderedCandidates: "
              + orderedCandidates);
    }
    if (inOutLine.getC_OrderLine_ID() < 1) {
      throw new IllegalStateException(
          "inOutLine needs to have a C_OrderLine_ID > 0" + "\n inOutLine: " + inOutLine);
    }
    if (CompleteStatus.INCOMPLETE_ORDER.equals(completeStatus)) {
      throw new IllegalArgumentException(
          "completeStatus may not be "
              + CompleteStatus.INCOMPLETE_ORDER
              + " (this will be figured out later by this class)");
    }

    final MInOutLine inOutLinePO = getPO(inOutLine);
    final MInOut inOutPO = getPO(inOut);

    inOut2Line.get(inOutPO).add(inOutLinePO);
    line2InOut.put(inOutLinePO, inOutPO);

    // store the inoutLine's orderId and status as well to support our
    // later purge
    line2CompleteStatus.put(inOutLinePO, completeStatus);
    line2PostageFreeStatus.put(inOutLinePO, PostageFreeStatus.OK);

    final MOrder orderPO = InterfaceWrapperHelper.getPO(order);

    Set<MInOutLine> inOutLines = order2InOutLine.get(orderPO);
    if (inOutLines == null) {
      inOutLines = new HashSet<MInOutLine>();
      order2InOutLine.put(orderPO, inOutLines);
    }
    inOutLines.add(inOutLinePO);

    //
    // C_OrderLine_ID to M_InOutLine mapping
    {
      final MInOutLine inOutLinePO_Old =
          orderLineId2InOutLine.put(inOutLine.getC_OrderLine_ID(), inOutLinePO);
      if (inOutLinePO_Old != null && inOutLinePO_Old != inOutLinePO) {
        throw new IllegalArgumentException(
            "An InOutLine was already set for order line in orderLineId2InOutLine mapping"
                + "\n InOutLine: "
                + inOutLinePO
                + "\n InOutLine (old): "
                + inOutLinePO_Old
                + "\n orderLineId2InOutLine (after change): "
                + orderLineId2InOutLine);
      }
    }

    line2sched.put(inOutLinePO, sched);
  }
예제 #4
0
 private MInOut getPO(final I_M_InOut inOut) {
   final MInOut inOutPO = InterfaceWrapperHelper.getPO(inOut);
   return inOutPO;
 }