Package com.commander4j.db

Examples of com.commander4j.db.JDBQuery2


  private PreparedStatement buildSQLr()
  {

    PreparedStatement result;
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_EXPIRY");
   
    if (jCheckBoxConfirmed.isSelected())
    {
      q2.applyWhere("confirmed=", 'Y');
    } else
    {
      q2.applyWhere("confirmed=", 'N');
    }

    if (jTextFieldSSCC.getText().equals("") == false)
    {
      q2.applyWhere("sscc = ", jTextFieldSSCC.getText());
    }

    if (textFieldMHN.getText().equals("") == false)
    {
      q2.applyWhere("mhn_number = ", textFieldMHN.getText());
    }

    if (jTextFieldMaterial.getText().equals("") == false)
    {
      q2.applyWhere("material = ", jTextFieldMaterial.getText());
    }

    if (jTextFieldCustomer.getText().equals("") == false)
    {
      q2.applyWhere("customer_id=", jTextFieldCustomer.getText());
    }

    if (jTextFieldBatch.getText().equals("") == false)
    {
      q2.applyWhere("batch_number like ", jTextFieldBatch.getText());
    }

    if (jTextFieldProcessOrder.getText().equals("") == false)
    {
      q2.applyWhere("process_order = ", jTextFieldProcessOrder.getText());
    }

    if (jTextFieldLocation.getText().equals("") == false)
    {
      q2.applyWhere("location_id = ", jTextFieldLocation.getText());
    }

    if (jTextFieldEAN.getText().equals("") == false)
    {
      q2.applyWhere("EAN = ", jTextFieldEAN.getText());
    }

    if (jTextFieldDespatch_No.getText().equals("") == false)
    {
      q2.applyWhere("DESPATCH_NO = ", jTextFieldDespatch_No.getText());
    }

    if (jTextFieldVariant.getText().equals("") == false)
    {
      q2.applyWhere("variant = ", jTextFieldVariant.getText());
    }

    if (((JDBMHNDecisions) comboBoxDecisions.getSelectedItem()).getDecision().equals("") == false)
    {
      q2.applyWhere("decision = ", ((JDBMHNDecisions) comboBoxDecisions.getSelectedItem()).getDecision());
    }

    q2.applyWhere("uom=", ((JDBUom) jComboBoxUOM.getSelectedItem()).getInternalUom());

    q2.applyWhere("status=", ((String) jComboBoxPalletStatus.getSelectedItem()).toString());

    if (jCheckBoxQuantity.isSelected())
    {
      if (jFormattedTextFieldQuantity.getText().equals("") == false)
      {
        q2.applyWhere("quantity=", JUtility.stringToBigDecimal(jFormattedTextFieldQuantity.getText().toString()));
      }
    }

    if (jCheckBoxDOMFrom.isSelected())
    {
      q2.applyWhere("date_of_manufacture>=", JUtility.getTimestampFromDate(domDateFrom.getDate()));
    }

    if (jCheckBoxDOMTo.isSelected())
    {
      q2.applyWhere("date_of_manufacture<=", JUtility.getTimestampFromDate(domDateTo.getDate()));
    }

    if (jCheckBoxExpiryFrom.isSelected())
    {
      q2.applyWhere("expiry_date>=", JUtility.getTimestampFromDate(expiryDateFrom.getDate()));
    }

    if (jCheckBoxExpiryTo.isSelected())
    {
      q2.applyWhere("expiry_date<=", JUtility.getTimestampFromDate(expiryDateTo.getDate()));
    }
   
    if (jCheckBoxCreatedFrom.isSelected())
    {
      q2.applyWhere("date_created>=", JUtility.getTimestampFromDate(createdDateFrom.getDate()));
    }

    if (jCheckBoxCreatedTo.isSelected())
    {
      q2.applyWhere("date_created<=", JUtility.getTimestampFromDate(createdDateTo.getDate()));
    }
   
    if (jCheckBoxUpdatedFrom.isSelected())
    {
      q2.applyWhere("date_updated>=", JUtility.getTimestampFromDate(updatedDateFrom.getDate()));
    }

    if (jCheckBoxUpdatedFrom.isSelected())
    {
      q2.applyWhere("date_updated<=", JUtility.getTimestampFromDate(updatedDateTo.getDate()));
    }
   
    if (textFieldUserCreated.getText().equals("") == false)
    {
      q2.applyWhere("created_by_user_id = ", textFieldUserCreated.getText());
    }
   
    if (textFieldUserUpdated.getText().equals("") == false)
    {
      q2.applyWhere("updated_by_user_id = ", textFieldUserUpdated.getText());
    }
   
    Integer i;

    try
    {
      i = Integer.valueOf(jFormattedTextFieldQuantity.getText());
      q2.applyWhere("quantity=", i);
    } catch (Exception e)
    {
    }

    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applyRestriction(jCheckBoxLimit.isSelected(),  jSpinnerLimit.getValue());
    q2.applySQL();
    result = q2.getPreparedStatement();

    return result;
  }
View Full Code Here


  private PreparedStatement buildSQL1Record()
  {
    PreparedStatement result;

    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID, Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("VIEW_PALLET_EXPIRY");

    int row = jTable1.getSelectedRow();
    if (row >= 0)
    {
      lsscc = jTable1.getValueAt(row, 0).toString();
    } else
    {
      lsscc = "";
    }

    if (lsscc.equals("") == false)
    {
      q2.applyWhere("sscc = ", lsscc);
    }

    q2.applyRestriction(false, 0);
    q2.applySQL();
    result = q2.getPreparedStatement();
    return result;
  }
View Full Code Here

    expiryMode = ctrl.getKeyValue("EXPIRY DATE MODE");

    initGUI();

    ////////
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_HISTORY_EXPIRY WHERE 1=2");
    q2.applyRestriction(false, 0);
    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applySQL();
    listStatement = q2.getPreparedStatement();
    ////////
   
    populateList();

    final JHelp help = new JHelp();
View Full Code Here

  }

  private PreparedStatement buildSQLr() {
   
    PreparedStatement result;
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_HISTORY_EXPIRY");
   

    if (jCheckBoxTransactionDate.isSelected())
    {
      q2.applyWhere("transaction_date>=", JUtility.getTimestampFromDate(transactionDateFrom.getDate()));
      q2.applyWhere("transaction_date<=", JUtility.getTimestampFromDate(transactionDateTo.getDate()));
    }


    if (jTextFieldTransaction_Ref.getText().equals("") == false)
    {
      q2.applyWhere("transaction_ref = ", jTextFieldTransaction_Ref.getText());
    }

    if (jTextFieldSSCC.getText().equals("") == false)
    {
      q2.applyWhere("sscc = ", jTextFieldSSCC.getText());
    }

    if (jTextFieldMaterial.getText().equals("") == false)
    {
      q2.applyWhere("material = ", jTextFieldMaterial.getText());
    }

    if (jTextFieldBatch.getText().equals("") == false)
    {
      q2.applyWhere("batch_number like ", jTextFieldBatch.getText());
    }

    if (jTextFieldProcessOrder.getText().equals("") == false)
    {
      q2.applyWhere("process_order = ", jTextFieldProcessOrder.getText());
    }

    if (jTextFieldLocation.getText().equals("") == false)
    {
      q2.applyWhere("location_id = ", jTextFieldLocation.getText());
    }

    if (jTextFieldUser.getText().equals("") == false)
    {
      q2.applyWhere("user_id = ", jTextFieldUser.getText());
    }

    if (jTextFieldEAN.getText().equals("") == false)
    {
      q2.applyWhere("EAN = ", jTextFieldEAN.getText());
    }

    if (jTextFieldDespatch_No.getText().equals("") == false)
    {
      q2.applyWhere("DESPATCH_NO = ", jTextFieldDespatch_No.getText());
    }

    if (jTextFieldVariant.getText().equals("") == false)
    {
      q2.applyWhere("variant = ", jTextFieldVariant.getText());
    }

    q2.applyWhere("transaction_type=", (String) comboBoxTransactionType.getSelectedItem());

    q2.applyWhere("transaction_subtype=", (String) comboBoxTransactionSubtype.getSelectedItem());

    q2.applyWhere("uom=", ((JDBUom) jComboBoxUOM.getSelectedItem()).getInternalUom());

    q2.applyWhere("status=", ((String) jComboBoxPalletStatus.getSelectedItem()).toString());

    if (jCheckBoxQuantity.isSelected())
    {
      if (jFormattedTextFieldQuantity.getText().equals("") == false)
      {
        q2.applyWhere("quantity=",JUtility.stringToBigDecimal(jFormattedTextFieldQuantity.getText().toString()));
      }
    }

    Integer i;

    try
    {
      i = Integer.valueOf(jFormattedTextFieldQuantity.getText());
      q2.applyWhere("quantity=", i);
    }
    catch (Exception e)
    {
    }

    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applyRestriction(jCheckBoxLimit.isSelected(), jSpinnerLimit.getValue());
    q2.applySQL();
   
    result = q2.getPreparedStatement();
   
    return result;
  }
View Full Code Here

 
  private void buildSQL() {
   
    JDBQuery2.closeStatement(listStatement);

    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID, Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_HISTORY_EXPIRY");

    if (jCheckBoxTransactionDate.isSelected())
    {
      q2.applyWhere("transaction_date>=", JUtility.getTimestampFromDate(transactionDateFrom.getDate()));
      q2.applyWhere("transaction_date<=", JUtility.getTimestampFromDate(transactionDateTo.getDate()));
    }


    if (jTextFieldTransaction_Ref.getText().equals("") == false)
    {
      q2.applyWhere("transaction_ref = ", jTextFieldTransaction_Ref.getText());
    }

    if (jTextFieldSSCC.getText().equals("") == false)
    {
      q2.applyWhere("sscc = ", jTextFieldSSCC.getText());
    }

    if (jTextFieldMaterial.getText().equals("") == false)
    {
      q2.applyWhere("material = ", jTextFieldMaterial.getText());
    }

    if (jTextFieldBatch.getText().equals("") == false)
    {
      q2.applyWhere("batch_number like ", jTextFieldBatch.getText());
    }

    if (jTextFieldProcessOrder.getText().equals("") == false)
    {
      q2.applyWhere("process_order = ", jTextFieldProcessOrder.getText());
    }

    if (jTextFieldLocation.getText().equals("") == false)
    {
      q2.applyWhere("location_id = ", jTextFieldLocation.getText());
    }

    if (jTextFieldUser.getText().equals("") == false)
    {
      q2.applyWhere("user_id = ", jTextFieldUser.getText());
    }

    if (jTextFieldEAN.getText().equals("") == false)
    {
      q2.applyWhere("EAN = ", jTextFieldEAN.getText());
    }

    if (jTextFieldDespatch_No.getText().equals("") == false)
    {
      q2.applyWhere("DESPATCH_NO = ", jTextFieldDespatch_No.getText());
    }

    if (jTextFieldVariant.getText().equals("") == false)
    {
      q2.applyWhere("variant = ", jTextFieldVariant.getText());
    }

    q2.applyWhere("transaction_type=", (String) comboBoxTransactionType.getSelectedItem());

    q2.applyWhere("transaction_subtype=", (String) comboBoxTransactionSubtype.getSelectedItem());

    q2.applyWhere("uom=", ((JDBUom) jComboBoxUOM.getSelectedItem()).getInternalUom());

    q2.applyWhere("status=", ((String) jComboBoxPalletStatus.getSelectedItem()).toString());

    if (jCheckBoxQuantity.isSelected())
    {
      if (jFormattedTextFieldQuantity.getText().equals("") == false)
      {
        q2.applyWhere("quantity=",JUtility.stringToBigDecimal(jFormattedTextFieldQuantity.getText().toString()));
      }
    }

    Integer i;

    try
    {
      i = Integer.valueOf(jFormattedTextFieldQuantity.getText());
      q2.applyWhere("quantity=", i);
    }
    catch (Exception e)
    {
    }

    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applyRestriction(jCheckBoxLimit.isSelected(), jSpinnerLimit.getValue());
    q2.applySQL();
    listStatement = q2.getPreparedStatement();
  }
View Full Code Here

    initGUI();
   
   
    ////////
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}APP_LOCATION WHERE 1=2");
    q2.applyRestriction(false, 0);
    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applySQL();
    listStatement = q2.getPreparedStatement();
    ////////
   
    populateList();

    final JHelp help = new JHelp();
View Full Code Here

  }

  private PreparedStatement buildSQLr() {
       
    PreparedStatement result;
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}APP_LOCATION");
    q2.applyWhere("location_id=", jTextFieldLocationID.getText());;
    q2.applyWhere("plant=", jTextFieldPlant.getText());
    q2.applyWhere("warehouse=", jTextFieldWarehouse.getText());
    if (jTextFieldDescription.getText().equals("") == false)
    {
      q2.applyWhere("upper(description) LIKE ", "%" + jTextFieldDescription.getText().toUpperCase() + "%");
    }
    q2.applyWhere("storage_location=", jTextFieldStorageLocation.getText());
    q2.applyWhere("storage_type=", jTextFieldStorageType.getText());
    q2.applyWhere("storage_section=", jTextFieldStorageSection.getText());
    q2.applyWhere("storage_bin=", jTextFieldStorageBin.getText());
    q2.applyWhere("gln=", jTextFieldGLN.getText());
   
    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applyRestriction(false, 0);
    q2.applySQL();
    result = q2.getPreparedStatement();
   
    return result;
 
View Full Code Here

    typeList.addAll(t.getMaterialTypes());

    initGUI();

    ////////
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_EXPIRY WHERE 1=2");
    q2.applyRestriction(false, 0);
    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applySQL();
    listStatement = q2.getPreparedStatement();
    ////////
   
    populateList();

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
View Full Code Here

  private PreparedStatement buildSQLr()
  {

    PreparedStatement result;
    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID,Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("{schema}VIEW_PALLET_EXPIRY");
   
    if (jCheckBoxConfirmed.isSelected())
    {
      q2.applyWhere("confirmed=", 'Y');
    } else
    {
      q2.applyWhere("confirmed=", 'N');
    }

    if (jTextFieldSSCC.getText().equals("") == false)
    {
      q2.applyWhere("sscc = ", jTextFieldSSCC.getText());
    }

    if (textFieldMHN.getText().equals("") == false)
    {
      q2.applyWhere("mhn_number = ", textFieldMHN.getText());
    }

    if (jTextFieldMaterial.getText().equals("") == false)
    {
      q2.applyWhere("material = ", jTextFieldMaterial.getText());
    }

    if (jTextFieldCustomer.getText().equals("") == false)
    {
      q2.applyWhere("customer_id=", jTextFieldCustomer.getText());
    }

    if (jTextFieldBatch.getText().equals("") == false)
    {
      q2.applyWhere("batch_number like ", jTextFieldBatch.getText());
    }

    if (jTextFieldProcessOrder.getText().equals("") == false)
    {
      q2.applyWhere("process_order = ", jTextFieldProcessOrder.getText());
    }

    if (jTextFieldLocation.getText().equals("") == false)
    {
      q2.applyWhere("location_id = ", jTextFieldLocation.getText());
    }

    if (jTextFieldEAN.getText().equals("") == false)
    {
      q2.applyWhere("EAN = ", jTextFieldEAN.getText());
    }

    if (jTextFieldDespatch_No.getText().equals("") == false)
    {
      q2.applyWhere("DESPATCH_NO = ", jTextFieldDespatch_No.getText());
    }

    if (jTextFieldVariant.getText().equals("") == false)
    {
      q2.applyWhere("variant = ", jTextFieldVariant.getText());
    }

    if (((JDBMHNDecisions) comboBoxDecisions.getSelectedItem()).getDecision().equals("") == false)
    {
      q2.applyWhere("decision = ", ((JDBMHNDecisions) comboBoxDecisions.getSelectedItem()).getDecision());
    }

    q2.applyWhere("uom=", ((JDBUom) jComboBoxUOM.getSelectedItem()).getInternalUom());

    q2.applyWhere("status=", ((String) jComboBoxPalletStatus.getSelectedItem()).toString());

    if (jCheckBoxQuantity.isSelected())
    {
      if (jFormattedTextFieldQuantity.getText().equals("") == false)
      {
        q2.applyWhere("quantity=", JUtility.stringToBigDecimal(jFormattedTextFieldQuantity.getText().toString()));
      }
    }

    if (jCheckBoxDOMFrom.isSelected())
    {
      q2.applyWhere("date_of_manufacture>=", JUtility.getTimestampFromDate(domDateFrom.getDate()));
    }

    if (jCheckBoxDOMTo.isSelected())
    {
      q2.applyWhere("date_of_manufacture<=", JUtility.getTimestampFromDate(domDateTo.getDate()));
    }

    if (jCheckBoxExpiryFrom.isSelected())
    {
      q2.applyWhere("expiry_date>=", JUtility.getTimestampFromDate(expiryDateFrom.getDate()));
    }

    if (jCheckBoxExpiryTo.isSelected())
    {
      q2.applyWhere("expiry_date<=", JUtility.getTimestampFromDate(expiryDateTo.getDate()));
    }
   
    if (jCheckBoxCreatedFrom.isSelected())
    {
      q2.applyWhere("date_created>=", JUtility.getTimestampFromDate(createdDateFrom.getDate()));
    }

    if (jCheckBoxCreatedTo.isSelected())
    {
      q2.applyWhere("date_created<=", JUtility.getTimestampFromDate(createdDateTo.getDate()));
    }
   
    if (jCheckBoxUpdatedFrom.isSelected())
    {
      q2.applyWhere("date_updated>=", JUtility.getTimestampFromDate(updatedDateFrom.getDate()));
    }

    if (jCheckBoxUpdatedFrom.isSelected())
    {
      q2.applyWhere("date_updated<=", JUtility.getTimestampFromDate(updatedDateTo.getDate()));
    }
   
    if (textFieldUserCreated.getText().equals("") == false)
    {
      q2.applyWhere("created_by_user_id = ", textFieldUserCreated.getText());
    }
   
    if (textFieldUserUpdated.getText().equals("") == false)
    {
      q2.applyWhere("updated_by_user_id = ", textFieldUserUpdated.getText());
    }
   
    Integer i;

    try
    {
      i = Integer.valueOf(jFormattedTextFieldQuantity.getText());
      q2.applyWhere("quantity=", i);
    } catch (Exception e)
    {
    }

    q2.applySort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
    q2.applyRestriction(jCheckBoxLimit.isSelected(),  jSpinnerLimit.getValue());
    q2.applySQL();
    result = q2.getPreparedStatement();

    return result;
  }
View Full Code Here

  private PreparedStatement buildSQL1Record()
  {
    PreparedStatement result;

    JDBQuery2 q2 = new JDBQuery2(Common.selectedHostID, Common.sessionID);
    q2.applyWhat("*");
    q2.applyFrom("VIEW_PALLET_EXPIRY");

    int row = jTable1.getSelectedRow();
    if (row >= 0)
    {
      lsscc = jTable1.getValueAt(row, 0).toString();
    } else
    {
      lsscc = "";
    }

    if (lsscc.equals("") == false)
    {
      q2.applyWhere("sscc = ", lsscc);
    }

    q2.applyRestriction(false, 0);
    q2.applySQL();
    result = q2.getPreparedStatement();
    return result;
  }
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBQuery2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.