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

Commit

Permalink
update src/main/java/org/isf/medicalinventory/manager/MedicalInventor…
Browse files Browse the repository at this point in the history
…yManager.java
  • Loading branch information
ArnaudFonzam committed Aug 8, 2024
1 parent 1f0e344 commit 8960b38
Showing 1 changed file with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,24 +241,21 @@ public void validateInventory(MedicalInventory inventory, List<MedicalInventoryR
Medical medical = medicalInventoryRow.getMedical();
List<Movement> movs = groupedByMedical.get(medical);
if (movs != null) {
for (Movement mov: movs) {
String lotCodeOfMovement = mov.getLot().getCode();
Lot lot = movStockInsertingManager.getLot(lotCodeOfMovement);
double mainStoreQty = (double)lot.getMainStoreQuantity();
if (lotCodeOfMovement.equals(lotCode)) {
if (mainStoreQty != theoQty) {
medicalInventoryRow.setTheoreticQty(mainStoreQty);
medicalInventoryRow.setRealqty(mainStoreQty);
medicalInventoryRowManager.updateMedicalInventoryRow(medicalInventoryRow);
}
} else {
Integer medicalCode = medical.getCode();
MedicalInventoryRow inventoryRow = medicalInventoryRowManager.getMedicalInventoryRowByMedicalCodeAndLotCode(medicalCode, lotCodeOfMovement);
if (inventoryRow == null) {
MedicalInventoryRow medInvRow = new MedicalInventoryRow(0, mainStoreQty, mainStoreQty, inventory, medical, lot);
medicalInventoryRowManager.newMedicalInventoryRow(medInvRow);
}
Movement mov = movs.get(0);
String lotCodeOfMovement = mov.getLot().getCode();
Lot lot = movStockInsertingManager.getLot(lotCodeOfMovement);
double mainStoreQty = (double)lot.getMainStoreQuantity();
Integer medicalCode = medical.getCode();
Integer movMedicalCode = mov.getMedical().getCode();
if (movMedicalCode.equals(medicalCode) && lotCodeOfMovement.equals(lotCode)) {
if (mainStoreQty != theoQty) {
medicalInventoryRow.setTheoreticQty(mainStoreQty);
medicalInventoryRow.setRealqty(mainStoreQty);
medicalInventoryRowManager.updateMedicalInventoryRow(medicalInventoryRow);
}
} else {
MedicalInventoryRow medInvRow = new MedicalInventoryRow(0, mainStoreQty, mainStoreQty, inventory, medical, lot);
medicalInventoryRowManager.newMedicalInventoryRow(medInvRow);
}
}
}
Expand Down

0 comments on commit 8960b38

Please sign in to comment.