/**
  * left qtyToDeliver_Override to null, set DeliveryRule_Override to null, qtyToDeliver is set on
  * 0.
  */
 @Test
 public void testQtyToDeliver4() {
   I_M_ShipmentSchedule sched = createShipmentSchedule(new BigDecimal("14"));
   sched.setQtyToDeliver_Override(new BigDecimal("10"));
   shipmentScheduleBL.setQtyToDeliverWhenNullInoutLine(sched);
   Assert.assertEquals("Invalid qtyToDeliver", BigDecimal.valueOf(0), sched.getQtyToDeliver());
 }
예제 #2
0
  @Override
  protected String doIt() throws Exception {
    if (shipmentSchedule == null || shipmentSchedule.getM_ShipmentSchedule_ID() <= 0) {
      throw new FillMandatoryException(I_M_ShipmentSchedule.COLUMNNAME_M_ShipmentSchedule_ID);
    }

    final I_C_OrderLine orderLine = shipmentSchedule.getC_OrderLine();
    final OlAndSched olAndSched = new OlAndSched(orderLine, shipmentSchedule);

    final ShipmentScheduleQtyOnHandStorage storagesContainer =
        new ShipmentScheduleQtyOnHandStorage();
    storagesContainer.setContext(this);
    storagesContainer.setDate(SystemTime.asDayTimestamp());
    storagesContainer.setCachedObjects(new CachedObjects());
    storagesContainer.loadStoragesFor(olAndSched);

    final List<ShipmentScheduleStorageRecord> storageRecords =
        storagesContainer.getStorageRecordsMatching(olAndSched);

    final BigDecimal qtyOnHandTotal =
        Services.get(IStorageBL.class).calculateQtyOnHandSum(storageRecords);
    addLog("@QtyOnHand@ (@Total@): " + qtyOnHandTotal);

    for (final ShipmentScheduleStorageRecord storage : storageRecords) {
      addLog("------------------------------------------------------------");
      addLog(storage.getSummary());
    }

    //
    // Also show the Storage Query
    {
      final IStorageQuery storageQuery = storagesContainer.createStorageQuery(olAndSched);
      addLog("------------------------------------------------------------");
      addLog("Storage Query:");
      addLog(storageQuery.getSummary());
    }

    return MSG_OK;
  }