Skip to content

Commit

Permalink
O3-3074 :Add condition in search for catch null UOMUuid in the method…
Browse files Browse the repository at this point in the history
… findStockOperationItems
  • Loading branch information
slubwama committed Apr 14, 2024
1 parent 3e2ccd6 commit a134675
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1509,36 +1509,32 @@ public Result<StockOperationItemDTO> findStockOperationItems(StockOperationItemS

if (filter.getIncludePackagingUnitName()) {
Optional<ConceptNameDTO> conceptNameDTO = null;
if (stockOperationItemDTO.getPackagingUoMId() != null) {
if (stockOperationItemDTO.getPackagingUoMId() != null && stockOperationItemDTO.getStockItemPackagingUOMUuid()!=null) {
conceptNameDTO = conceptNameDTOs.stream().filter(p -> p.getConceptId().equals(stockOperationItemDTO.getPackagingUoMId())).findFirst();
if (conceptNameDTO.isPresent()) {
stockOperationItemDTO.setStockItemPackagingUOMName(conceptNameDTO.get().getName());
}

BigDecimal factor = Context.getService(StockManagementService.class).getStockItemPackagingUOMByUuid(stockOperationItemDTO.getStockItemPackagingUOMUuid()).getFactor();
BigDecimal factor = getStockItemPackagingUOMByUuid(stockOperationItemDTO.getStockItemPackagingUOMUuid()).getFactor();

stockOperationItemDTO.setStockItemPackagingUOMFactor(factor);
stockOperationItemDTO.setStockItemPackagingUOMFactor(factor);
}

if (stockOperationItemDTO.getQuantityReceivedPackagingUOMUoMId() != null) {
if (stockOperationItemDTO.getQuantityReceivedPackagingUOMUoMId() != null && stockOperationItemDTO.getQuantityReceivedPackagingUOMUuid()!=null) {
conceptNameDTO = conceptNameDTOs.stream().filter(p -> p.getConceptId().equals(stockOperationItemDTO.getQuantityReceivedPackagingUOMUoMId())).findFirst();
if (conceptNameDTO.isPresent()) {
stockOperationItemDTO.setQuantityReceivedPackagingUOMName(conceptNameDTO.get().getName());
}

BigDecimal factor = Context.getService(StockManagementService.class).getStockItemPackagingUOMByUuid(stockOperationItemDTO.getQuantityReceivedPackagingUOMUuid()).getFactor();

BigDecimal factor = getStockItemPackagingUOMByUuid(stockOperationItemDTO.getQuantityReceivedPackagingUOMUuid()).getFactor();
stockOperationItemDTO.setQuantityReceivedPackagingUOMFactor(factor);
}

if (stockOperationItemDTO.getQuantityRequestedPackagingUOMUoMId() != null) {
if (stockOperationItemDTO.getQuantityRequestedPackagingUOMUoMId() != null && stockOperationItemDTO.getQuantityRequestedPackagingUOMUuid()!=null) {
conceptNameDTO = conceptNameDTOs.stream().filter(p -> p.getConceptId().equals(stockOperationItemDTO.getQuantityRequestedPackagingUOMUoMId())).findFirst();
if (conceptNameDTO.isPresent()) {
stockOperationItemDTO.setQuantityRequestedPackagingUOMName(conceptNameDTO.get().getName());
}

BigDecimal factor = Context.getService(StockManagementService.class).getStockItemPackagingUOMByUuid(stockOperationItemDTO.getQuantityReceivedPackagingUOMUuid()).getFactor();

BigDecimal factor = getStockItemPackagingUOMByUuid(stockOperationItemDTO.getQuantityRequestedPackagingUOMUuid()).getFactor();
stockOperationItemDTO.setQuantityRequestedPackagingUOMFactor(factor);
}
}
Expand Down Expand Up @@ -3208,13 +3204,13 @@ public Result<StockItemTransactionDTO> findStockItemTransactions(StockItemTransa

for (StockItemTransactionDTO stockItemTransactionDTO : result.getData()) {

if (stockItemTransactionDTO.getPackagingUoMId() != null) {
if (stockItemTransactionDTO.getPackagingUoMId() != null && stockItemTransactionDTO.getStockItemPackagingUOMUuid() != null) {
Optional<ConceptNameDTO> conceptNameDTO = conceptNameDTOs.stream().filter(p -> p.getConceptId().equals(stockItemTransactionDTO.getPackagingUoMId())).findFirst();
if (conceptNameDTO.isPresent()) {
stockItemTransactionDTO.setPackagingUomName(conceptNameDTO.get().getName());
}

BigDecimal factor = Context.getService(StockManagementService.class).getStockItemPackagingUOMByUuid(stockItemTransactionDTO.getStockItemPackagingUOMUuid()).getFactor();
BigDecimal factor = getStockItemPackagingUOMByUuid(stockItemTransactionDTO.getStockItemPackagingUOMUuid()).getFactor();

stockItemTransactionDTO.setPackagingUomFactor(factor);
}
Expand Down

0 comments on commit a134675

Please sign in to comment.