Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudFonzam committed Oct 9, 2024
2 parents c51a908 + 550bbbe commit 8fb48ee
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public enum MovementOrder {
*
* @return {@code true} if automatic lot mode, {@code false} otherwise.
*/
private boolean isAutomaticLotMode() {
private boolean isAutomaticLotInMode() {
return GeneralData.AUTOMATICLOT_IN;
}

Expand Down Expand Up @@ -180,26 +180,23 @@ public List<Movement> newAutomaticDischargingMovement(Movement movement) throws
* Stores the specified {@link Movement}.
*
* @param movement - the movement to store.
* @return the stored {@link Movement}.
* @throws OHServiceException if an error occurs during the store operation.
*/
public Movement newMovement(Movement movement) throws OHServiceException {
String lotCode = null;
Lot lot = movement.getLot();

if (movement.getLot() != null) {
lotCode = movement.getLot().getCode();
if (lot != null) {
lotCode = lot.getCode();
}

// we have to manage the Lot
if (movement.getType().getType().contains("+")) {
// if is in automatic lot mode then we have to generate a new lot code
if (isAutomaticLotMode() || "".equals(lotCode)) {
lotCode = generateLotCode();
}

boolean lotExists = lotExists(lotCode);
if (!lotExists) {
storeLot(lotCode, movement.getLot(), movement.getMedical());
}
// if charging we have to manage the Lot, if discharging the lot should be given
boolean chargeMovement = movement.getType().getType().contains("+");
boolean lotExists = lotExists(lotCode);
if (chargeMovement && !lotExists) {
lot = storeLot(lotCode, movement.getLot(), movement.getMedical());
lotCode = lot.getCode();
}

Movement movementStored = storeMovement(movement, lotCode);
Expand Down Expand Up @@ -312,7 +309,7 @@ public Lot updateLot(Lot lot) throws OHServiceException {
/**
* Stores the specified {@link Lot}.
*
* @param lotCode the {@link Lot} code.
* @param lotCode the {@link Lot} code. If {@code null} or {@code empty} it will be generated.
* @param lot the lot to store.
* @param medical
* @return the stored {@link Lot} object.
Expand All @@ -322,6 +319,9 @@ public Lot updateLot(Lot lot) throws OHServiceException {
public Lot storeLot(String lotCode, Lot lot, Medical medical) throws OHServiceException {
if (lotCode == null || lotCode.equals("")) {
lotCode = this.generateLotCode();
if (!isAutomaticLotInMode()) {
LOGGER.warn("AUTOMATICLOT_IN mode set to 'false' but lot code not provided. Generating... {}.", lotCode);
}
}
lot.setCode(lotCode);
lot.setMedical(medical);
Expand Down Expand Up @@ -590,7 +590,8 @@ public List<Movement> getMovementForPrint(
}

/**
* Retrieves lot referred to the specified {@link Medical}, expiring first on top Lots with zero quantities will be stripped out if removeEmpty is set to true.
* Retrieves lot referred to the specified {@link Medical}, expiring first on top Lots with zero quantities will be stripped out if removeEmpty is set to
* true.
*
* @param medical the medical.
* @param removeEmpty
Expand Down

0 comments on commit 8fb48ee

Please sign in to comment.