コード例 #1
0
  private final void addAllocationPerformed(final IMRPDemandToSupplyAllocation alloc) {
    Check.assumeNotNull(alloc, "alloc not null");

    final I_PP_MRP mrpSupplyRecord = alloc.getMRPSupply();
    final BigDecimal mrpSupplyQty = alloc.getQtyAllocated();

    //
    // Check allocated MRP supply and create MRP notes in case something is not ok
    checkMRPSupplyDates(alloc);

    //
    // Update cummulated values
    if (mrpBL.isQtyOnHandReservation(mrpSupplyRecord)) {
      this.qtyOnHandReserved = this.qtyOnHandReserved.add(mrpSupplyQty);
    } else if (mrpBL.isQtyOnHandAnyReservation(mrpSupplyRecord)) {
      // skip any other kind of reservations
    } else {
      final boolean mrpSupplyIsFirm = mrpBL.isReleased(mrpSupplyRecord);
      if (mrpSupplyIsFirm) {
        this.qtyScheduledReceipts = qtyScheduledReceipts.add(mrpSupplyQty);
      }
      this.qtySuppliedTotal = qtySuppliedTotal.add(mrpSupplyQty);
    }

    subtractFromQtyToSupplyRemaining(mrpSupplyQty);

    mrpDemand2supplyAllocations.add(alloc);
  }
コード例 #2
0
  /**
   * If this DD Order's MRP demand record was fully allocated from QOH then complete forward DD
   * Orders
   *
   * @task
   *     http://dewiki908/mediawiki/index.php/07961_Handelsware_DD_Order_automatisieren_%28101259925191%29
   */
  @Override
  public void onQtyOnHandReservation(
      final IMRPContext mrpContext,
      final IMRPExecutor mrpExecutor,
      final IMRPDemandToSupplyAllocation mrpDemandToSupplyAllocation) {
    final I_PP_MRP mrpDemand = mrpDemandToSupplyAllocation.getMRPDemand();
    final int ddOrderId = mrpDemand.getDD_Order_ID();
    if (ddOrderId <= 0) {
      return;
    }

    if (mrpBL.isReleased(mrpDemand)) {
      return;
    }

    if (!mrpDemandToSupplyAllocation.isMRPDemandFullyAllocated()) {
      return;
    }

    //
    // Restrictions
    final int ppPlantId = mrpDemand.getS_Resource_ID();
    if (ppPlantId <= 0) {
      // shall not happen
      return;
    }

    final DocumentsToCompleteAfterMRPExecution scheduler =
        DocumentsToCompleteAfterMRPExecution.getCreate(mrpExecutor);
    scheduler.enqueueDDOrderForMRPDemand(mrpDemand);
  }
コード例 #3
0
  /** Check Scheduled Dates for given MRP Supply record and creates MRP notes if needed */
  private void checkMRPSupplyDates(final IMRPDemandToSupplyAllocation mrpDemandToSupplyAlloc) {
    //
    // Extract from parameters only what we need
    final IMRPContext mrpContext = getMRPContext();
    final Date mrpRunDate =
        mrpContext.getDate(); // date when MRP is executed; this is our reference date
    final I_PP_MRP mrpDemandRecord =
        mrpDemandToSupplyAlloc
            .getMRPDemand(); // NOTE: MRP Demand is needed only as a reference, no other
    // informations are/shall be used from there
    final I_PP_MRP mrpSupplyRecord = mrpDemandToSupplyAlloc.getMRPSupply();
    final BigDecimal mrpSupplyQty = mrpDemandToSupplyAlloc.getQtyAllocated();

    // In case is QOH allocation, consider it valid
    if (mrpBL.isQtyOnHandAnyReservation(mrpSupplyRecord)) {
      return;
    }

    //
    //
    final boolean mrpSupplyIsFirm = mrpBL.isReleased(mrpSupplyRecord);
    final boolean mrpSupplyQtyNotZero = mrpSupplyQty.signum() != 0;
    final Date mrpSupplyDateFinishSchedule =
        mrpSupplyRecord
            .getDateFinishSchedule(); // Date when the supply it's scheduled by MRP to be available
    // in our warehouse
    final Date mrpSupplyDatePromised =
        mrpSupplyRecord
            .getDatePromised(); // Date when supply is promised by "vendor" to be available in our
    // warehouse

    //
    // MRP-030 De-Expedite Action Notice
    // Indicates that a schedule supply order is due before it is needed and should be delayed,
    // or demand rescheduled to an earlier date.
    // aka: Push Out
    if (mrpSupplyIsFirm
        && mrpSupplyQtyNotZero
        && mrpSupplyDateFinishSchedule != null
        && mrpSupplyDateFinishSchedule.compareTo(demandDateStartSchedule)
            < 0 // supply is scheduled to arrive before it's needed
    ) {
      newSupplyMRPNote(mrpSupplyRecord, "MRP-030")
          .addParameter("DateSupply", mrpSupplyDateFinishSchedule)
          .addParameter("DateDemand", demandDateStartSchedule)
          .addParameter("PP_MRP_Demand_ID", mrpDemandRecord)
          .collect();
    }

    //
    // MRP-040 Expedite Action Notice
    // Indicates that a scheduled supply order is due after is needed and should be rescheduled to
    // an earlier date or demand rescheduled to a later date.
    // aka: Pull In
    if (mrpSupplyIsFirm
        && mrpSupplyQtyNotZero
        && mrpSupplyDateFinishSchedule != null
        && mrpSupplyDateFinishSchedule.compareTo(demandDateStartSchedule)
            > 0 // supply is scheduled to arrive after it's needed (that could be a serious problem)
    ) {
      newSupplyMRPNote(mrpSupplyRecord, "MRP-040")
          .addParameter("DateSupply", mrpSupplyDateFinishSchedule)
          .addParameter("DateDemand", demandDateStartSchedule)
          .addParameter("PP_MRP_Demand_ID", mrpDemandRecord)
          .collect();
    }

    //
    // MRP-060 Release Due For Action Notice in time
    // Indicate that a supply order should be released. if it is a draft order, it must also be
    // approved.
    // if(date release > today && date release + after floating)
    if (!mrpSupplyIsFirm
        && mrpSupplyQtyNotZero
        && mrpSupplyDatePromised.compareTo(mrpRunDate) >= 0) {
      newSupplyMRPNote(mrpSupplyRecord, MRPExecutor.MRP_ERROR_060_SupplyDueButNotReleased)
          .addParameter("SupplyDatePromised", mrpSupplyDatePromised)
          .addParameter("MRPDateRun", mrpRunDate)
          .collect();
    }

    //
    // MRP-070 Release Past Due For Action Notice overdue
    // Indicates that a supply order was not released when it was due, and should be either released
    // or expedited now, or the demand rescheduled for a later date.
    // if (date release < today && date erelese + before floating)
    if (!mrpSupplyIsFirm
        && mrpSupplyQtyNotZero
        && mrpSupplyDatePromised.compareTo(mrpRunDate) < 0) {
      newSupplyMRPNote(mrpSupplyRecord, MRPExecutor.MRP_ERROR_070_SupplyPastDueButNotReleased)
          .addParameter("SupplyDatePromised", mrpSupplyDatePromised)
          .addParameter("MRPDateRun", mrpRunDate)
          .collect();
    }

    //
    // MRP-110 Past Due Action Notice
    // Indicates that a schedule supply order receipt is past due.
    // i.e. it's a firm supply which was scheduled to be released in the past, but so far it's not
    // received yet.
    if (mrpSupplyIsFirm && mrpSupplyDatePromised.compareTo(mrpRunDate) < 0) {
      newSupplyMRPNote(mrpSupplyRecord, MRPExecutor.MRP_ERROR_110_SupplyPastDueButReleased)
          .addParameter("SupplyDatePromised", mrpSupplyDatePromised)
          .addParameter("MRPDateRun", mrpRunDate)
          .collect();
    }
  }