Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
add check to show the message if some theoreticals qty have been updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudFonzam committed Sep 3, 2024
1 parent 2efeed9 commit 960c77e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public void validateInventory(MedicalInventory inventory, List<MedicalInventoryR
LocalDateTime movFrom = inventory.getLastModifiedDate();
LocalDateTime movTo = TimeTools.getNow();
List<Movement> movements = movBrowserManager.getMovements(null, null, null, null, movFrom, movTo, null, null, null, null);
boolean updated = false;
if (!movements.isEmpty()) {
Map<Medical, List<Movement>> groupedByMedical = movements.stream().collect(Collectors.groupingBy(Movement::getMedical));
for (Iterator<MedicalInventoryRow> iterator = inventoryRowSearchList.iterator(); iterator.hasNext();) {
Expand All @@ -254,6 +255,7 @@ public void validateInventory(MedicalInventory inventory, List<MedicalInventoryR
if (mainStoreQty != theoQty) {
medicalInventoryRow.setTheoreticQty(mainStoreQty);
medicalInventoryRowManager.updateMedicalInventoryRow(medicalInventoryRow);
updated = true;
}
} else {
MedicalInventoryRow invRow = medicalInventoryRowManager.getMedicalInventoryRowByMedicalCodeAndLotCode(medicalCode, lotCode);
Expand All @@ -269,5 +271,10 @@ public void validateInventory(MedicalInventory inventory, List<MedicalInventoryR
}
}
}
if (updated) {
List<OHExceptionMessage> errors = new ArrayList<>();
errors.add(new OHExceptionMessage(MessageBundle.getMessage("angal.inventory.sometheoriticqtyhavebeenupdatepleasecontrole.msg")));
throw new OHDataValidationException(errors);
}
}
}

0 comments on commit 960c77e

Please sign in to comment.