@Test public void shouldGetStockCardsBeforePeriodEndDate() throws Exception { Program program1 = new ProgramBuilder().setProgramCode("code1").build(); Program program2 = new ProgramBuilder().setProgramCode("code2").setParentCode("code1").build(); Program program3 = new ProgramBuilder().setProgramCode("code3").build(); generateTestDataForGetStockCards("P1", true, false, program1, "1969-11-11"); generateTestDataForGetStockCards("P2", true, false, program1, "1970-11-11"); generateTestDataForGetStockCards("P3", true, false, program2, "1969-11-11"); generateTestDataForGetStockCards("P4", true, false, program3, "1969-11-11"); DateTime periodBegin = new DateTime(DateUtil.parseString("1970-01-01 10:10:10", DateUtil.DATE_TIME_FORMAT)); DateTime periodEnd = new DateTime(DateUtil.parseString("1970-02-21 10:10:10", DateUtil.DATE_TIME_FORMAT)); RnRForm rnRForm = RnRForm.init(program1, new Period(periodBegin, periodEnd), false); List<StockCard> stockCardsBeforeTimeLine = stockRepository.getStockCardsBeforePeriodEnd(rnRForm); assertThat(stockCardsBeforeTimeLine.size(), is(2)); assertThat(stockCardsBeforeTimeLine.get(0).getProduct().getCode(), is("P1")); assertThat(stockCardsBeforeTimeLine.get(1).getProduct().getCode(), is("P3")); }
protected List<StockCard> getStockCardsBeforePeriodEnd(RnRForm rnRForm) throws LMISException { return getStockCardsBeforePeriodEnd(rnRForm.getProgram().getProgramCode(), rnRForm.getPeriodEnd()); }
StockRepository { protected List<StockCard> getStockCardsBeforePeriodEnd(RnRForm rnRForm) throws LMISException { return getStockCardsBeforePeriodEnd(rnRForm.getProgram().getProgramCode(), rnRForm.getPeriodEnd()); } }
StockRepository { protected List<StockCard> getStockCardsBeforePeriodEnd(RnRForm rnRForm) throws LMISException { return getStockCardsBeforePeriodEnd(rnRForm.getProgram().getProgramCode(), rnRForm.getPeriodEnd()); } @Inject  StockRepository(Context context); }
StockRepository { protected List<StockCard> getStockCardsBeforePeriodEnd(RnRForm rnRForm) throws LMISException { return getStockCardsBeforePeriodEnd(rnRForm.getProgram().getProgramCode(), rnRForm.getPeriodEnd()); } @Inject  StockRepository(Context context); void batchSaveUnpackStockCardsWithMovementItemsAndUpdateProduct(final List<StockCard> stockCards); void createOrUpdate(final StockCard stockCard); void refresh(StockCard stockCard); void updateProductOfStockCard(Product product); void createOrUpdateStockCardWithStockMovement(final StockCard stockCard); synchronized void addStockMovementAndUpdateStockCard(final StockMovementItem stockMovementItem); List<StockCard> list(); boolean hasStockData(); boolean hasOldDate(); List<StockCard> listStockCardsByProductIds(final List<Long> productIds); List<StockCard> listEmergencyStockCards(); StockCard queryStockCardById(final long id); StockCard queryStockCardByProductId(final long productId); void updateStockCardWithProduct(final StockCard stockCard); List<StockCard> getStockCardsBelongToProgram(String programCode); void batchCreateSyncDownStockCardsAndMovements(final List<StockCard> stockCards); void deleteOldData(); void deletedData(StockCard stockCard); StockCard queryStockCardByProductCode(String productCode); void deleteStockDirtyData(List<String> productCodeList); void resetStockCard(List<String> productCodeList); void insertNewInventory(List<String> productCodeList); void resetLotsOnHand(List<String> productCodeList); }
StockRepository { protected List<StockCard> getStockCardsBeforePeriodEnd(RnRForm rnRForm) throws LMISException { return getStockCardsBeforePeriodEnd(rnRForm.getProgram().getProgramCode(), rnRForm.getPeriodEnd()); } @Inject  StockRepository(Context context); void batchSaveUnpackStockCardsWithMovementItemsAndUpdateProduct(final List<StockCard> stockCards); void createOrUpdate(final StockCard stockCard); void refresh(StockCard stockCard); void updateProductOfStockCard(Product product); void createOrUpdateStockCardWithStockMovement(final StockCard stockCard); synchronized void addStockMovementAndUpdateStockCard(final StockMovementItem stockMovementItem); List<StockCard> list(); boolean hasStockData(); boolean hasOldDate(); List<StockCard> listStockCardsByProductIds(final List<Long> productIds); List<StockCard> listEmergencyStockCards(); StockCard queryStockCardById(final long id); StockCard queryStockCardByProductId(final long productId); void updateStockCardWithProduct(final StockCard stockCard); List<StockCard> getStockCardsBelongToProgram(String programCode); void batchCreateSyncDownStockCardsAndMovements(final List<StockCard> stockCards); void deleteOldData(); void deletedData(StockCard stockCard); StockCard queryStockCardByProductCode(String productCode); void deleteStockDirtyData(List<String> productCodeList); void resetStockCard(List<String> productCodeList); void insertNewInventory(List<String> productCodeList); void resetLotsOnHand(List<String> productCodeList);  }