Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-1189 | validate Inventory #2030

Merged
merged 68 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
5843c62
add validate action
Jul 31, 2024
e5d64c0
Merge branch 'develop' into OP-1189
Jul 31, 2024
980bbd3
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
98cf598
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
724444f
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
890f961
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
68ae690
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
8e71c91
Update bundle/language_en.properties
ArnaudFonzam Jul 31, 2024
628c8ba
update logique and apply the new
Aug 6, 2024
4f4f578
update bundle
Aug 6, 2024
2105b36
Merge branch 'develop' into OP-1189
Aug 7, 2024
df9e883
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Aug 7, 2024
00a24d7
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Aug 8, 2024
039e42e
Merge branch 'develop' into OP-1189
Aug 8, 2024
329b338
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Aug 13, 2024
58ffd51
Update bundle/language_en.properties
ArnaudFonzam Aug 14, 2024
357cb20
Update bundle/language_en.properties
ArnaudFonzam Aug 14, 2024
a7c3c50
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Aug 14, 2024
06e51f3
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
Aug 14, 2024
214767a
Merge branch 'develop' into OP-1189
Aug 20, 2024
2fb9eaf
Update bundle/language_en.properties
ArnaudFonzam Sep 3, 2024
c5e4431
Update bundle/language_en.properties
ArnaudFonzam Sep 3, 2024
fa59f0b
update bundle to add new message
Sep 3, 2024
613b333
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
mwithi Sep 4, 2024
ac1c231
Rename one field
mwithi Sep 4, 2024
2008c32
Remove useless field and format code
mwithi Sep 4, 2024
f3d7892
Remove deprecated field
mwithi Sep 4, 2024
b62b53a
Fix exception after focus out on real qty
mwithi Sep 4, 2024
b4bed23
Update one label
mwithi Sep 4, 2024
0237c1e
update logic of validate Inventory
Sep 4, 2024
45437a0
Merge pull request #1 from mwithi/mwithi-OP-1189
ArnaudFonzam Sep 4, 2024
1830cfc
Merge pull request #2 from mwithi/mwithi-OP-1189
ArnaudFonzam Sep 5, 2024
f379a63
fix conflicté
Sep 5, 2024
b484798
update InventoryEdit
Sep 5, 2024
f2f3026
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
Sep 5, 2024
ab2400c
fix bug on InventoryEdit
Sep 6, 2024
682f4ff
update validate method
Sep 11, 2024
9e38446
update InventoryEdit
Sep 12, 2024
db9e64d
Merge branch 'develop' into OP-1189
Sep 12, 2024
3061e2b
Merge branch 'OP-1199-Main-Store-Inventory' into OP-1189
ArnaudFonzam Sep 12, 2024
32e3263
Update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
ArnaudFonzam Sep 13, 2024
e73a4ab
Update bundle/language_en.properties
ArnaudFonzam Sep 13, 2024
a679974
Update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
ArnaudFonzam Sep 13, 2024
fa8fd27
update validate inventory'
Sep 23, 2024
05e08ba
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
Sep 23, 2024
07f0b7e
Merge branch 'OP-1199-Main-Store-Inventory' into OP-1189
ArnaudFonzam Sep 24, 2024
4b62098
update Inventory Edit
Sep 24, 2024
689254d
update InventoryEdit.java
Sep 24, 2024
ef8a306
Merge branch 'develop' into OP-1189
Sep 25, 2024
4612397
git fix error Index out of bound
Sep 27, 2024
1b80cdc
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Sep 28, 2024
0a9c62f
Update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
ArnaudFonzam Sep 30, 2024
f04f400
update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Sep 30, 2024
9a73921
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
Sep 30, 2024
d94b0c9
update Inventory
Sep 30, 2024
82437bf
Update src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
ArnaudFonzam Oct 1, 2024
04963d4
apply suggestion
Oct 1, 2024
78d28f3
fix error on update Cost of lot
Oct 2, 2024
327f546
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
mwithi Oct 2, 2024
8876f0f
OP-1344: dialog method takes bundle key and not the final text (#2060)
dbmalkovsky Oct 2, 2024
9b630a3
Add bundles
mwithi Oct 2, 2024
bcf0fcb
Refactor validation method and change errors severity
mwithi Oct 2, 2024
9e2c008
create new inventory during validation phase if we have new charge mo…
Oct 3, 2024
8bd6484
Merge branch 'OP-1189' into ArnaudFonzam-OP-1189
ArnaudFonzam Oct 3, 2024
42cb7ba
Merge pull request #4 from mwithi/ArnaudFonzam-OP-1189
ArnaudFonzam Oct 3, 2024
03548b1
fix conflict
Oct 3, 2024
e1fb376
Merge branch 'OP-1189' of https://github.com/ArnaudFonzam/openhospita…
Oct 3, 2024
95145e2
Merge branch 'develop' into OP-1189
Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bundle/language_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,9 @@ angal.inventory.cancelednoteditable.msg
angal.inventory.chargetype.label = Charge Type
angal.inventory.clean.btn = Clean Table
angal.inventory.clean.btn.key = T
angal.inventory.choosedischargetypebeforevalidate.msg = Please choose discharge type and save inventory before validate.
angal.inventory.choosechargetypebeforevalidate.msg = Please choose charge type and save inventory before validate.
angal.inventory.choosesupplierbeforevalidate.msg = Please choose supplier and save inventory before validate.
angal.inventory.destination.label = Destination
angal.inventory.dischargetype.label = Discharge Type
angal.inventory.draft = Draft
Expand Down Expand Up @@ -727,6 +730,12 @@ angal.inventory.done
angal.inventory.validate.btn = Validate
angal.inventory.validate.btn.key = V
angal.inventory.validatednoteditable.msg = A validated inventory cannot be modified.
angal.inventory.inventorymustsavebeforevalidate.msg = Inventory must be save before validate.
angal.inventory.inventoryalreadyvalidate.msg = Inventory is already validate.
angal.inventory.validate.success.msg = The inventory has been successfully validated.
angal.inventory.validate.error.msg = Error during inventory validation.
angal.inventory.validateajustinventoryerror.msg = Errors occur during stock's adjustment.
angal.inventory.allinventoryrowshouldhavelotbeforevalidate.msg = All the inventory rows should have lot before validate.
angal.inventory.viewinventory.title = View Inventory
angal.inventory.youhavealreadyaddedallproduct.msg = You have already added all the products.
angal.inventoryrow.realqty.col = Real Qty
Expand Down
2 changes: 2 additions & 0 deletions rsc/sms.properties.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ skebby-gateway-service.ribbon.base-url=https://api.skebby.it:443
# USER_KEY and ACCESS_TOKEN avoids the login call every time we need to send sms
skebby-gateway-service.accessToken=
skebby-gateway-service.userKey=
# message_type: GP for Classic+, TI for Classic, SI for Basic (default)
#skebby-gateway-service.messageType=


##################################################################
Expand Down
84 changes: 83 additions & 1 deletion src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ private void fireInventoryUpdated() {
private JButton saveButton;
private JButton resetButton;
private JButton lotButton;
private JButton validateButton;
private JScrollPane scrollPaneInventory;
private JTable jTableInventoryRow;
private List<MedicalInventoryRow> inventoryRowList;
Expand Down Expand Up @@ -265,6 +266,7 @@ public void windowClosing(WindowEvent e) {
});
if (mode.equals("view")) {
saveButton.setVisible(false);
validateButton.setVisible(false);
deleteButton.setVisible(false);
columnEditable = columnEditableView;
codeTextField.setEditable(false);
Expand All @@ -280,6 +282,7 @@ public void windowClosing(WindowEvent e) {
lotButton.setVisible(false);
} else {
saveButton.setVisible(true);
validateButton.setVisible(true);
deleteButton.setVisible(true);
codeTextField.setEditable(true);
resetButton.setVisible(true);
Expand Down Expand Up @@ -428,6 +431,7 @@ private JPanel getPanelFooter() {
if (panelFooter == null) {
panelFooter = new JPanel();
panelFooter.add(getSaveButton());
panelFooter.add(getValidateButton());
panelFooter.add(getDeleteButton());
panelFooter.add(getLotButton());
panelFooter.add(getCleanTableButton());
Expand Down Expand Up @@ -538,8 +542,8 @@ private JButton getSaveButton() {
}
medicalInventoryRowManager.newMedicalInventoryRow(medicalInventoryRow);
}
// enable validation
mode = "update";
validateButton.setEnabled(true);
MessageDialog.info(this, "angal.inventory.savesuccess.msg");
fireInventoryInserted();
resetVariable();
Expand Down Expand Up @@ -889,6 +893,83 @@ private JButton getCleanTableButton() {
return resetButton;
}

private JButton getValidateButton() {
validateButton = new JButton(MessageBundle.getMessage("angal.inventory.validate.btn"));
validateButton.setMnemonic(MessageBundle.getMnemonic("angal.inventory.validate.btn.key"));
if (inventory == null) {
validateButton.setEnabled(false);
}
validateButton.addActionListener(actionEvent -> {
if (inventory == null) {
MessageDialog.info(null, "angal.inventory.inventorymustsavebeforevalidate.msg");
return;
}
if (inventory != null) {
if (inventory.getStatus().equals(InventoryStatus.validated.toString())) {
MessageDialog.info(null, "angal.inventory.inventoryalreadyvalidate.msg");
return;
}
}
List<MedicalInventoryRow> invRowWithoutLot = inventoryRowSearchList.stream().filter(invRow -> invRow.getLot() == null).collect(Collectors.toList());
if (invRowWithoutLot.size() > 0) {
MessageDialog.info(null, "angal.inventory.allinventoryrowshouldhavelotbeforevalidate.msg");
return;
}
String dischargeCode = inventory.getDischargeType();
String chargeCode = inventory.getChargeType();
Integer supplierId = inventory.getSupplier();
String wardCode = inventory.getDestination();
if (dischargeCode == null || dischargeCode.equals("")) {
MessageDialog.info(null, "angal.inventory.choosedischargetypebeforevalidate.msg");
return;
}
if (chargeCode == null || chargeCode.equals("")) {
MessageDialog.info(null, "angal.inventory.choosechargetypebeforevalidate.msg");
return;
}
if (supplierId == null || supplierId == 0) {
MessageDialog.info(null, "angal.inventory.choosesupplierbeforevalidate.msg");
return;
}
if (wardCode == null || wardCode.equals("")) {
MessageDialog.info(null, "angal.inventory.choosesupplierbeforevalidate.msg");
return;
}
// validate inventory
boolean validated = false;
try {
validated = medicalInventoryManager.validateInventory(inventory, inventoryRowSearchList);
} catch (OHServiceException e) {
OHServiceExceptionUtil.showMessages(e);
return;
}
// change state of inventory
if (validated) {
inventory.setStatus(InventoryStatus.validated.toString());
try {
inventory = medicalInventoryManager.updateMedicalInventory(inventory);
} catch (OHServiceException e) {
OHServiceExceptionUtil.showMessages(e);
return;
}
if (inventory != null) {
MessageDialog.info(null, "angal.inventory.validate.success.msg");
columnEditable = columnEditableView;
jTableInventoryRow.updateUI();
fireInventoryUpdated();
saveButton.setEnabled(false);
} else {
MessageDialog.info(null, "angal.inventory.validate.error.msg");
return;
}
} else {
MessageDialog.info(null, "angal.inventory.validateajustinventoryerror.msg");
return;
}
}
);
return validateButton;
}
private JScrollPane getScrollPaneInventory() {
if (scrollPaneInventory == null) {
scrollPaneInventory = new JScrollPane();
Expand Down Expand Up @@ -1110,6 +1191,7 @@ public void setValueAt(Object value, int r, int c) {
}
inventoryRowListAdded.add(invRow);
inventoryRowSearchList.set(r, invRow);
jTableInventoryRow.updateUI();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/isf/sms/gui/SmsEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public SmsEdit(JFrame owner) {
}

private void initialize() {
maxLength = SmsManager.MAX_LENGHT;
maxLength = SmsManager.MAX_LENGTH;
}

private void initComponents() {
Expand Down
Loading