Skip to content

Commit

Permalink
Merge branch 'develop' into feature/OP-1043-users-and-groups-soft-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi authored Oct 31, 2024
2 parents e4b4a7b + 4396336 commit c5b9d6d
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.isf.medicals.service.MedicalsIoOperations;
import org.isf.medicalstock.model.Lot;
import org.isf.medicalstock.model.Movement;
import org.isf.medicalstock.service.LotIoOperationRepository;
import org.isf.medicalstock.service.MedicalStockIoOperations;
import org.isf.utils.db.TranslateOHServiceException;
import org.isf.utils.exception.OHDataValidationException;
Expand All @@ -48,9 +49,13 @@ public class MovStockInsertingManager {

private MedicalsIoOperations ioOperationsMedicals;

public MovStockInsertingManager(MedicalStockIoOperations medicalStockIoOperations, MedicalsIoOperations medicalsIoOperations) {
private LotIoOperationRepository ioOperationsLots;

public MovStockInsertingManager(MedicalStockIoOperations medicalStockIoOperations, MedicalsIoOperations medicalsIoOperations,
LotIoOperationRepository ioOperationsLots) {
this.ioOperations = medicalStockIoOperations;
this.ioOperationsMedicals = medicalsIoOperations;
this.ioOperationsLots = ioOperationsLots;
}

/**
Expand Down Expand Up @@ -209,6 +214,17 @@ private void validateLot(List<OHExceptionMessage> errors, Lot lot, boolean check
}
}

/**
* Checks if the specified {@link Lot} exists.
*
* @param lotCode the lot code.
* @return {@code true} if exists, {@code false} otherwise.
* @throws OHServiceException if an error occurs during the check.
*/
public boolean lotExists(String lotCode) throws OHServiceException {
return ioOperationsLots.findById(String.valueOf(lotCode)).orElse(null) != null;
}

/**
* Verify if the referenceNumber is valid for CRUD and return a list of errors, if any
*
Expand Down

0 comments on commit c5b9d6d

Please sign in to comment.