Search in sources :

Example 1 with SmartcodePrint

use of SmartcodeParser.SmartcodePrint in project SmartCity-Market by TechnionYP5777.

the class ManagePackagesTab method runTheOperationButtonPressed.

@FXML
private void runTheOperationButtonPressed(ActionEvent __) {
    SmartCode smartcode = new SmartCode(Long.parseLong(barcodeTextField.getText()), datePicker.getValue());
    int amountVal = editPackagesAmountSpinner.getValue();
    log.info("===============================runTheOperationButtonPressed======================================");
    log.info("amount in spinner: " + amountVal);
    try {
        if (barcodeOperationsPane.isVisible()) {
            log.info("barcode pane is visible");
            if (addPakageToWarhouseRadioButton.isSelected()) {
                log.info("addPakageToWarhouseRadioButton");
                // init
                Location loc = new Location(0, 0, PlaceInMarket.WAREHOUSE);
                ProductPackage pp = new ProductPackage(smartcode, amountVal, loc);
                // exec
                worker.addProductToWarehouse(pp);
                printToSuccessLog("Added (" + amountVal + ") " + "product packages (" + pp + ") to warehouse");
                this.expirationDate = datePicker.getValue();
                searchCodeButtonPressed(null);
            }
        } else if (addPackageToStoreRadioButton.isSelected()) {
            log.info("addPackageToStoreRadioButton");
            Location loc = new Location(0, 0, PlaceInMarket.STORE);
            ProductPackage pp = new ProductPackage(smartcode, amountVal, loc);
            worker.placeProductPackageOnShelves(pp);
            printToSuccessLog("Added (" + amountVal + ") " + "product packages (" + pp + ") to store");
            searchCodeButtonPressed(null);
        } else if (removePackageFromStoreRadioButton.isSelected()) {
            log.info("removePackageFromStoreRadioButton");
            Location loc = new Location(0, 0, PlaceInMarket.STORE);
            ProductPackage pp = new ProductPackage(smartcode, amountVal, loc);
            worker.removeProductPackageFromStore(pp);
            printToSuccessLog("Removed (" + amountVal + ") " + "product packages (" + pp + ") from store");
            searchCodeButtonPressed(null);
        } else if (!removePackageFromWarhouseRadioButton.isSelected()) {
            if (printSmartCodeRadioButton.isSelected())
                new SmartcodePrint(smartcode, amountVal).print();
        } else {
            log.info("removePackageFromWarhouseRadioButton");
            Location loc = new Location(0, 0, PlaceInMarket.WAREHOUSE);
            ProductPackage pp = new ProductPackage(smartcode, amountVal, loc);
            worker.removeProductPackageFromStore(pp);
            printToSuccessLog("Removed (" + amountVal + ") " + "product packages (" + pp + ") from warehouse");
            searchCodeButtonPressed(null);
        }
    } catch (SMException e) {
        log.fatal(e);
        log.debug(StackTraceUtil.getStackTrace(e));
        e.showInfoToUser();
    }
    log.info("===============================runTheOperationButtonPressed======================================");
}
Also used : SmartCode(BasicCommonClasses.SmartCode) ProductPackage(BasicCommonClasses.ProductPackage) SmartcodePrint(SmartcodeParser.SmartcodePrint) SMException(SMExceptions.SMException) SmartcodePrint(SmartcodeParser.SmartcodePrint) Location(BasicCommonClasses.Location) FXML(javafx.fxml.FXML)

Aggregations

Location (BasicCommonClasses.Location)1 ProductPackage (BasicCommonClasses.ProductPackage)1 SmartCode (BasicCommonClasses.SmartCode)1 SMException (SMExceptions.SMException)1 SmartcodePrint (SmartcodeParser.SmartcodePrint)1 FXML (javafx.fxml.FXML)1