Package com.commander4j.db

Examples of com.commander4j.db.JDBDespatch


      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = list_despatch.getSelectedValue();
            currentdespatchno = d.getDespatchNo();

            if (currentdespatchno.equals(previousdespatchno) == false)
            {
              previousdespatchno = currentdespatchno;
              textFieldDespatchLocationFrom.setText(d.getLocationIDFrom());
              textFieldDespatchLocationTo.setText(d.getLocationIDTo());
              textFieldDespatchStatus.setText(d.getStatus());

              if (d.getStatus().equals("Confirmed"))
              {
                deleteButton.setEnabled(false);
                jButtonLookupLocationTo.setEnabled(false);
                jButtonLookupLocationFrom.setEnabled(false);
                buttonSetUserID.setEnabled(false);
                jButtonLookupLoadNo.setEnabled(false);
                jButtonLookupTrailer.setEnabled(false);
                jButtonLookupHaulier.setEnabled(false);
                buttonUnAssign.setEnabled(false);
                buttonAssign.setEnabled(false);
                newButton.setEnabled(false);
              }
              else
              {
                deleteButton.setEnabled(true);
                jButtonLookupLocationFrom.setEnabled(true);
                buttonSetUserID.setEnabled(true);
                jButtonLookupLocationTo.setEnabled(true);
                jButtonLookupLoadNo.setEnabled(true);
                jButtonLookupTrailer.setEnabled(true);
                jButtonLookupHaulier.setEnabled(true);
                buttonUnAssign.setEnabled(true);
                buttonAssign.setEnabled(true);
                newButton.setEnabled(true);
              }

              try
              {
                jTextFieldDespatchDate.setText(d.getDespatchDate().toString().substring(0, 19));
              }
              catch (Exception ee)
              {
                jTextFieldDespatchDate.setText("N/A");
              }

              textFieldHaulier.setText(d.getHaulier());
              textFieldTrailer.setText(d.getTrailer());
              textFieldLoadNo.setText(d.getLoadNo());
              textFieldUserID.setText(d.getUserID());

              textFieldNoOfPallets.setText(Integer.toString(d.getTotalPallets()));
              setConfirmButtonStatus();
              setFindButtonStatus(d.getLocationIDFrom());

              populateAssignedList(d.getDespatchNo(), "");
              clearUnAssignedList();
            }
          }
          else
          {
            blankDespatchFields();
          }
        }
        else
        {
          jButtonLookupLocationFrom.setEnabled(false);
          buttonSetUserID.setEnabled(false);
          jButtonLookupLocationTo.setEnabled(false);
          jButtonLookupTrailer.setEnabled(false);
          jButtonLookupHaulier.setEnabled(false);
          buttonUnAssign.setEnabled(false);
          buttonAssign.setEnabled(false);
          populateAssignedList("", "");
        }
      }
    });
    list_despatch.setCellRenderer(Common.renderer_list);
    list_despatch.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(list_despatch);

    final JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(510, 30, 150, 345);
    desktopPane.add(scrollPane_1);

    list_unassigned = new JList4j<String>();
    list_unassigned.setLocation(0, -3);
    list_unassigned.setCellRenderer(Common.renderer_list_unassigned);
    list_unassigned.setBackground(Common.color_list_unassigned);
    scrollPane_1.setViewportView(list_unassigned);

    final JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(310, 30, 150, 345);
    desktopPane.add(scrollPane_2);

    list_assigned = new JList4j<String>();
    list_assigned.setCellRenderer(Common.renderer_list_assigned);
    list_assigned.setBackground(Common.color_list_assigned);
    scrollPane_2.setViewportView(list_assigned);

    comboBoxPalletStatus = new JComboBox<String>();

    comboBoxPalletStatus.setFont(Common.font_std);
    comboBoxPalletStatus.setBounds(672, 135, 143, 21);

    ComboBoxModel<String> jComboBoxDefaultPalletStatusModel = new DefaultComboBoxModel<String>(Common.palletStatusIncBlank);
    comboBoxPalletStatus.setModel(jComboBoxDefaultPalletStatusModel);
    comboBoxPalletStatus.setSelectedIndex(0);
    desktopPane.add(comboBoxPalletStatus);

    textFieldSSCC = new JTextField4j();
    textFieldSSCC.setBounds(672, 50, 143, 21);
    desktopPane.add(textFieldSSCC);

    final JLabel4j_std palletStatusLabel = new JLabel4j_std();
    palletStatusLabel.setText(lang.get("lbl_Pallet_Status"));
    palletStatusLabel.setBounds(672, 115, 128, 20);
    desktopPane.add(palletStatusLabel);

    final JLabel4j_std ssccLabel = new JLabel4j_std();
    ssccLabel.setText(lang.get("lbl_Pallet_SSCC"));
    ssccLabel.setBounds(672, 35, 128, 16);
    desktopPane.add(ssccLabel);

    textFieldMaterial = new JTextField4j();
    textFieldMaterial.setBounds(672, 90, 124, 21);
    desktopPane.add(textFieldMaterial);

    final JLabel4j_std materialLabel = new JLabel4j_std();
    materialLabel.setText(lang.get("lbl_Material"));
    materialLabel.setBounds(672, 75, 128, 16);
    desktopPane.add(materialLabel);

    textFieldBatch = new JTextField4j();
    textFieldBatch.setBounds(672, 175, 124, 21);
    desktopPane.add(textFieldBatch);

    final JLabel4j_std batchLabel = new JLabel4j_std();
    batchLabel.setText(lang.get("lbl_Batch"));
    batchLabel.setBounds(672, 160, 128, 16);
    desktopPane.add(batchLabel);
    buttonAssign.setEnabled(false);

    buttonAssign.setBounds(470, 150, 25, 25);
    buttonAssign.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (textFieldDespatchLocationTo.getText().equals(""))
        {
          jStatusText.setText("Please define Destination Location");
        }
        else
        {
          jStatusText.setText("");
          if (list_unassigned.getSelectedIndex() > -1)
          {
            String item = "";
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            for (int j = list_unassigned.getMaxSelectionIndex(); j >= list_unassigned.getMinSelectionIndex(); j--)
            {
              if (list_unassigned.isSelectedIndex(j))
              {
                item = (String) list_unassigned.getModel().getElementAt(j);

                if (d.assignSSCC(item))
                {
                  addtoList(assignedList, item);
                  removefromList(unassignedList, item);
                  jStatusText.setText("");
                }
                else
                {
                  jStatusText.setText(d.getErrorMessage());
                }
              }
            }

            list_assigned.setModel(addListtoModel(assignedList));
            list_unassigned.setModel(addListtoModel(unassignedList));
            textFieldNoOfPallets.setText(String.valueOf(assignedList.size()));

            d.setTotalPallets(assignedList.size());
            updateDespatch(d);
          }
        }
      }
    });
    desktopPane.add(buttonAssign);
    buttonUnAssign.setEnabled(false);

    buttonUnAssign.setBounds(470, 185, 25, 25);
    buttonUnAssign.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_assigned.getSelectedIndex() > -1)
        {
          String item = "";
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

          for (int j = list_assigned.getMaxSelectionIndex(); j >= list_assigned.getMinSelectionIndex(); j--)
          {
            if (list_assigned.isSelectedIndex(j))
            {
              item = (String) list_assigned.getModel().getElementAt(j);

              if (d.unassignSSCC(item))
              {
                removefromList(assignedList, item);
                addtoList(unassignedList, item);
              }
            }
          }

          list_assigned.setModel(addListtoModel(assignedList));
          list_unassigned.setModel(addListtoModel(unassignedList));
          textFieldNoOfPallets.setText(String.valueOf(assignedList.size()));

          d.setTotalPallets(assignedList.size());
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(buttonUnAssign);

    newButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Create"), lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);

        if (question == 0)
        {
          JDBDespatch d = new JDBDespatch(Common.selectedHostID, Common.sessionID);
          String number = "";
          number = d.generateNewDespatchNo();

          if (number.equals("") == false)
          {

            if (d.create())
            {
              d.updateUserID(number, Common.userList.getUser(Common.sessionID).getUserId());
              populateDespatchList(number);
              setConfirmButtonStatus();
            }
            else
            {
              JUtility.errorBeep();
              JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE,Common.icon_confirm);
            }
          }
          else
          {
            JUtility.errorBeep();
            JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
          }
        }
      }
    });
    newButton.setText(lang.get("btn_New"));
    newButton.setBounds(2, 388, 116, 30);
    desktopPane.add(newButton);

    deleteButton.setText(lang.get("btn_Delete"));
    deleteButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Delete") + " " + d.getDespatchNo() + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);

            if (question == 0)
            {
              d.delete();
              populateDespatchList("");
              setConfirmButtonStatus();
            }
          }
        }
      }
    });
    deleteButton.setBounds(238, 388, 116, 30);
    desktopPane.add(deleteButton);

    findButton.setText(lang.get("btn_Find"));
    findButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        buildUnassignedSQL();
        populateUnassignedList(listStatement, "");
      }
    });
    findButton.setBounds(672, 298, 143, 30);
    desktopPane.add(findButton);

    final JButton4j printButton = new JButton4j(Common.icon_report);
    printButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
            HashMap<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("p_despatch_no", d.getDespatchNo());
            JLaunchReport.runReport("RPT_DESPATCH", parameters, "", null, "");
          }
        }
      }
    });
    printButton.setText(lang.get("btn_Print"));
    printButton.setBounds(474, 388, 116, 30);
    desktopPane.add(printButton);

    jLabel10 = new JLabel4j_std();
    jLabel10.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    jLabel10.setHorizontalAlignment(SwingConstants.TRAILING);
    jLabel10.setText(lang.get("lbl_Limit"));
    jLabel10.setBounds(672, 244, 128, 21);
    desktopPane.add(jLabel10);

    jCheckBoxLimit = new JCheckBox4j();
    jCheckBoxLimit.setSelected(true);
    jCheckBoxLimit.setBackground(new Color(255, 255, 255));
    jCheckBoxLimit.setBounds(672, 264, 21, 21);
    desktopPane.add(jCheckBoxLimit);

    spinnerUnassignedLimit = new JSpinner();
    JSpinner.NumberEditor ne1 = new JSpinner.NumberEditor(spinnerUnassignedLimit);
    ne1.getTextField().setFont(Common.font_std);
    spinnerUnassignedLimit.setEditor(ne1);
    spinnerUnassignedLimit.setBounds(701, 264, 114, 20);
    spinnerUnassignedLimit.setValue(1000);
    desktopPane.add(spinnerUnassignedLimit);

    final JButton4j closeButton = new JButton4j(Common.icon_close);

    closeButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dispose();
      }
    });
    closeButton.setText(lang.get("btn_Close"));
    closeButton.setMnemonic(lang.getMnemonicChar());
    closeButton.setBounds(710, 388, 116, 30);
    desktopPane.add(closeButton);

    jButtonHelp.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
      }
    });
    jButtonHelp.setText(lang.get("btn_Help"));
    jButtonHelp.setBounds(592, 388, 116, 30);
    desktopPane.add(jButtonHelp);

    //
    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_ADMIN_DESPATCH"));

    confirmButton.setText(lang.get("btn_Confirm"));
    confirmButton.setEnabled(false);
    confirmButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            int n = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Confirm") + " " + d.getDespatchNo() + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);

            if (n == 0)
            {
              d.getDespatchProperties();
              if (d.confirm())
              {
                populateDespatchList("");
                setConfirmButtonStatus();
              }
              else
              {
                JUtility.errorBeep();
                JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE,Common.icon_confirm);
                populateDespatchList("");
              }
            }
          }
        }
      }
    });

    confirmButton.setBounds(356, 388, 116, 30);
    desktopPane.add(confirmButton);

    final JLabel4j_title despatchesLabel = new JLabel4j_title();
    despatchesLabel.setText(lang.get("lbl_Despatches"));
    despatchesLabel.setBounds(10, 10, 75, 16);
    desktopPane.add(despatchesLabel);

    final JLabel4j_title unassignedLabel = new JLabel4j_title();
    unassignedLabel.setText(lang.get("lbl_Unassigned"));
    unassignedLabel.setBounds(510, 10, 150, 16);
    desktopPane.add(unassignedLabel);

    final JLabel4j_title assignedLabel = new JLabel4j_title();
    assignedLabel.setText(lang.get("lbl_Assigned"));
    assignedLabel.setBounds(310, 10, 150, 16);
    desktopPane.add(assignedLabel);

    final JLabel4j_title palletFilterCriteriaLabel = new JLabel4j_title();
    palletFilterCriteriaLabel.setText(lang.get("lbl_Unassigned_Filter"));
    palletFilterCriteriaLabel.setBounds(672, 15, 125, 16);
    desktopPane.add(palletFilterCriteriaLabel);

    final JButton4j refreshButton = new JButton4j(Common.icon_refresh);
    refreshButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        refresh();
      }
    });
    refreshButton.setText(lang.get("btn_Refresh"));
    refreshButton.setBounds(120, 388, 116, 30);
    desktopPane.add(refreshButton);

    SpinnerNumberModel jSpinnerIntModel = new SpinnerNumberModel();
    jSpinnerIntModel.setMinimum(1);
    jSpinnerIntModel.setMaximum(50000);
    jSpinnerIntModel.setStepSize(1);
    JSpinner.NumberEditor ne2 = new JSpinner.NumberEditor(spinnerDespatchLimit);
    ne2.getTextField().setFont(Common.font_std);
    spinnerDespatchLimit.setEditor(ne2);
    spinnerDespatchLimit.setModel(jSpinnerIntModel);
    spinnerDespatchLimit.setBounds(100, 303, 60, 20);
    spinnerDespatchLimit.setValue(50);
    desktopPane.add(spinnerDespatchLimit);

    jLabel10_1 = new JLabel4j_std();
    jLabel10_1.setHorizontalAlignment(SwingConstants.TRAILING);
    jLabel10_1.setText(lang.get("lbl_Limit"));
    jLabel10_1.setBounds(15, 302, 70, 21);
    desktopPane.add(jLabel10_1);

    textFieldDespatchLocationFrom = new JTextField4j();
    textFieldDespatchLocationFrom.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (JUtility.isNullORBlank(textFieldDespatchLocationFrom.getText()) == true)
        {
          findButton.setEnabled(false);
        }
        else
        {
          findButton.setEnabled(true);
        }
      }
    });
    textFieldDespatchLocationFrom.setEditable(false);
    textFieldDespatchLocationFrom.setBounds(172, 51, 105, 20);
    desktopPane.add(textFieldDespatchLocationFrom);

    final JLabel4j_std locationLabel_1 = new JLabel4j_std();
    locationLabel_1.setText(lang.get("lbl_From_Location"));
    locationLabel_1.setBounds(172, 32, 100, 16);
    desktopPane.add(locationLabel_1);

    final JLabel4j_std palletStatusLabel_1 = new JLabel4j_std();
    palletStatusLabel_1.setText(lang.get("lbl_Despatch_Status"));
    palletStatusLabel_1.setBounds(170, 240, 105, 20);
    desktopPane.add(palletStatusLabel_1);

    textFieldDespatchStatus = new JTextField4j();
    textFieldDespatchStatus.setEditable(false);
    textFieldDespatchStatus.setBounds(170, 261, 128, 20);
    desktopPane.add(textFieldDespatchStatus);

    textFieldDespatchLocationTo = new JTextField4j();
    textFieldDespatchLocationTo.setEditable(false);
    textFieldDespatchLocationTo.setBounds(172, 91, 105, 20);
    desktopPane.add(textFieldDespatchLocationTo);

    final JLabel4j_std locationLabel_1_1 = new JLabel4j_std();
    locationLabel_1_1.setText(lang.get("lbl_To_Location"));
    locationLabel_1_1.setBounds(172, 75, 100, 16);
    desktopPane.add(locationLabel_1_1);

    final JLabel4j_std palletStatusLabel_1_1 = new JLabel4j_std();
    palletStatusLabel_1_1.setText(lang.get("lbl_Despatch_Date"));
    palletStatusLabel_1_1.setBounds(172, 285, 90, 20);
    desktopPane.add(palletStatusLabel_1_1);

    final JLabel4j_std palletStatusLabel_1_1_1 = new JLabel4j_std();
    palletStatusLabel_1_1_1.setText(lang.get("lbl_No_Of_Pallets"));
    palletStatusLabel_1_1_1.setBounds(172, 332, 120, 20);
    desktopPane.add(palletStatusLabel_1_1_1);

    textFieldNoOfPallets = new JTextField4j();
    textFieldNoOfPallets.setEditable(false);
    textFieldNoOfPallets.setBounds(172, 352, 60, 20);
    desktopPane.add(textFieldNoOfPallets);

    jTextFieldDespatchDate = new JTextField4j();
    jTextFieldDespatchDate.setEditable(false);
    jTextFieldDespatchDate.setBounds(172, 303, 125, 20);
    desktopPane.add(jTextFieldDespatchDate);

    jButtonLookupLocationFrom = new JButton4j(Common.icon_lookup);
    jButtonLookupLocationFrom.setEnabled(false);
    jButtonLookupLocationFrom.setBounds(277, 50, 21, 21);
    jButtonLookupLocationFrom.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "Y";

        if (JLaunchLookup.locations())
        {
          textFieldDespatchLocationFrom.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLocationIDFrom(JLaunchLookup.dlgResult);
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(jButtonLookupLocationFrom);

    jButtonLookupLocationTo = new JButton4j(Common.icon_lookup);
    jButtonLookupLocationTo.setEnabled(false);
    jButtonLookupLocationTo.setBounds(277, 90, 21, 21);
    jButtonLookupLocationTo.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "Y";

        if (JLaunchLookup.locations())
        {
          textFieldDespatchLocationTo.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLocationIDTo(JLaunchLookup.dlgResult);
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(jButtonLookupLocationTo);

    jButtonLookupMaterial = new JButton4j(Common.icon_lookup);
    jButtonLookupMaterial.setBounds(795, 90, 21, 21);
    jButtonLookupMaterial.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = false;
        JLaunchLookup.dlgCriteriaDefault = "";

        if (JLaunchLookup.materials())
        {
          textFieldMaterial.setText(JLaunchLookup.dlgResult);
        }
      }
    });
    desktopPane.add(jButtonLookupMaterial);

    jButtonLookupBatch = new JButton4j(Common.icon_lookup);
    jButtonLookupBatch.setBounds(795, 175, 21, 21);
    jButtonLookupBatch.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgCriteriaDefault = textFieldMaterial.getText();
        JLaunchLookup.dlgAutoExec = true;

        if (JLaunchLookup.materialBatches())
        {
          textFieldBatch.setText(JLaunchLookup.dlgResult);
        }
      }
    });
    desktopPane.add(jButtonLookupBatch);

    confirmedRadioButton.setBackground(Color.WHITE);
    confirmedRadioButton.setText(lang.get("lbl_Confirmed"));
    confirmedRadioButton.setBounds(10, 327, 129, 24);
    confirmedRadioButton.setFont(Common.font_std);
    confirmedRadioButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        com.commander4j.util.JWait.milliSec(100);
        populateDespatchList("");
        refresh();
      }
    });

    desktopPane.add(confirmedRadioButton);

    unconfirmedRadioButton.setBackground(Color.WHITE);
    unconfirmedRadioButton.setText(lang.get("lbl_Unconfirmed"));
    unconfirmedRadioButton.setBounds(10, 352, 129, 24);
    unconfirmedRadioButton.setSelected(true);
    unconfirmedRadioButton.setFont(Common.font_std);
    unconfirmedRadioButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        com.commander4j.util.JWait.milliSec(100);
        populateDespatchList("");
        refresh();
        newButton.setEnabled(true);
      }
    });
    desktopPane.add(unconfirmedRadioButton);

    buttonGroup_1.add(unconfirmedRadioButton);
    buttonGroup_1.add(confirmedRadioButton);

    final JLabel4j_std palletStatusLabel_1_2 = new JLabel4j_std();
    palletStatusLabel_1_2.setText(lang.get("lbl_Trailer"));
    palletStatusLabel_1_2.setBounds(172, 115, 105, 20);
    desktopPane.add(palletStatusLabel_1_2);

    textFieldTrailer = new JTextField4j();
    textFieldTrailer.setEditable(false);
    textFieldTrailer.setBounds(172, 136, 105, 20);

    desktopPane.add(textFieldTrailer);

    final JLabel4j_std palletStatusLabel_1_2_1 = new JLabel4j_std();
    palletStatusLabel_1_2_1.setText(lang.get("lbl_Haulier"));
    palletStatusLabel_1_2_1.setBounds(172, 158, 105, 20);
    desktopPane.add(palletStatusLabel_1_2_1);

    textFieldHaulier = new JTextField4j();
    textFieldHaulier.setEditable(false);
    textFieldHaulier.setBounds(172, 176, 105, 20);
    desktopPane.add(textFieldHaulier);

    jButtonLookupTrailer = new JButton4j();
    jButtonLookupTrailer.setEnabled(false);
    jButtonLookupTrailer.setText("...");
    jButtonLookupTrailer.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        String trailer;
        trailer = JOptionPane.showInputDialog(Common.mainForm, "Enter Trailer Reference");

        if (trailer != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setTrailer(trailer.toUpperCase());
          textFieldTrailer.setText(trailer.toUpperCase());
          updateDespatch(d);
        }
      }
    });
    jButtonLookupTrailer.setBounds(277, 135, 21, 21);
    desktopPane.add(jButtonLookupTrailer);

    jButtonLookupHaulier = new JButton4j();
    jButtonLookupHaulier.setEnabled(false);
    jButtonLookupHaulier.setText("...");
    jButtonLookupHaulier.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        String haulier;
        haulier = JOptionPane.showInputDialog(Common.mainForm, "Enter Haulier Reference");

        if (haulier != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setHaulier(haulier.toUpperCase());
          textFieldHaulier.setText(haulier.toUpperCase());
          updateDespatch(d);
        }
      }
    });
    jButtonLookupHaulier.setBounds(277, 175, 21, 21);
    desktopPane.add(jButtonLookupHaulier);

    jStatusText = new JLabel4j_std("");
    jStatusText.setBounds(0, 428, 830, 21);
    jStatusText.setForeground(new java.awt.Color(255, 0, 0));
    jStatusText.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    desktopPane.add(jStatusText);

    JLabel4j_std lblLoadNo = new JLabel4j_std();
    lblLoadNo.setText(lang.get("lbl_Load_No"));
    lblLoadNo.setBounds(172, 196, 105, 20);
    desktopPane.add(lblLoadNo);

    textFieldLoadNo = new JTextField4j();
    textFieldLoadNo.setText("");
    textFieldLoadNo.setEditable(false);
    textFieldLoadNo.setBounds(172, 216, 105, 20);
    desktopPane.add(textFieldLoadNo);

    jButtonLookupLoadNo = new JButton4j();
    jButtonLookupLoadNo.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent arg0)
      {
        String load;
        load = JOptionPane.showInputDialog(Common.mainForm, "Enter Load Number");

        if (load != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLoadNo(load.toUpperCase());
          textFieldLoadNo.setText(load.toUpperCase());
          updateDespatch(d);

        }

      }
    });
    jButtonLookupLoadNo.setText("...");
    jButtonLookupLoadNo.setEnabled(false);
    jButtonLookupLoadNo.setBounds(277, 215, 21, 21);
    desktopPane.add(jButtonLookupLoadNo);

    JLabel4j_std label = new JLabel4j_std();
    label.setText(lang.get("lbl_User_ID"));
    label.setBounds(672, 338, 128, 16);
    desktopPane.add(label);

    textFieldUserID = new JTextField4j();
    textFieldUserID.setText("");
    textFieldUserID.setEditable(false);
    textFieldUserID.setBounds(672, 356, 122, 20);
    desktopPane.add(textFieldUserID);

    buttonSetUserID = new JButton4j((Icon) null);
    buttonSetUserID.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "";

        if (JLaunchLookup.users())
        {
          textFieldUserID.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.updateUserID(d.getDespatchNo(), JLaunchLookup.dlgResult);

        }
      }
    });
    buttonSetUserID.setEnabled(false);
View Full Code Here


  {
    if (list_despatch.getModel().getSize() > 0)
    {
      if (list_despatch.getSelectedIndex() >= 0)
      {
        JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
        previousdespatchno = "";
        populateDespatchList(d.getDespatchNo());
      }
    }
  }
View Full Code Here

    if (list_despatch.getModel().getSize() > 0)
    {
      if (list_despatch.getSelectedIndex() >= 0)
      {
        JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

        q.addParamtoSQL("despatch_no <> ", d.getDespatchNo());

      }
    }

    if (textFieldDespatchNo.getText().equals("") == false)
View Full Code Here

  {
    int counter = 0;

    DefaultComboBoxModel<String> DefComboBoxMod = new DefaultComboBoxModel<String>();

    JDBDespatch temp = new JDBDespatch(Common.selectedHostID, Common.sessionID);
    assignedList.clear();
    assignedList.addAll(temp.getAssignedSSCCs(despatchno));

    int sel = -1;

    if (despatchno.isEmpty() == false)
    {
View Full Code Here

      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
            currentdespatchno = d.getDespatchNo();

            if (currentdespatchno.equals(previousdespatchno) == false)
            {
              previousdespatchno = currentdespatchno;
              textFieldDespatchLocationFrom.setText(d.getLocationIDFrom());
              textFieldDespatchLocationTo.setText(d.getLocationIDTo());
              textFieldDespatchStatus.setText(d.getStatus());

              if (d.getStatus().equals("Confirmed"))
              {
                deleteButton.setEnabled(false);
                jButtonLookupLocationTo.setEnabled(false);
                jButtonLookupLocationFrom.setEnabled(false);
                buttonSetUserID.setEnabled(false);
                jButtonLookupLoadNo.setEnabled(false);
                jButtonLookupTrailer.setEnabled(false);
                jButtonLookupHaulier.setEnabled(false);
                buttonUnAssign.setEnabled(false);
                buttonAssign.setEnabled(false);
                newButton.setEnabled(false);
              }
              else
              {
                deleteButton.setEnabled(true);
                jButtonLookupLocationFrom.setEnabled(true);
                buttonSetUserID.setEnabled(true);
                jButtonLookupLocationTo.setEnabled(true);
                jButtonLookupLoadNo.setEnabled(true);
                jButtonLookupTrailer.setEnabled(true);
                jButtonLookupHaulier.setEnabled(true);
                buttonUnAssign.setEnabled(true);
                buttonAssign.setEnabled(true);
                newButton.setEnabled(true);
              }

              try
              {
                jTextFieldDespatchDate.setText(d.getDespatchDate().toString().substring(0, 19));
              }
              catch (Exception ee)
              {
                jTextFieldDespatchDate.setText("N/A");
              }

              textFieldHaulier.setText(d.getHaulier());
              textFieldTrailer.setText(d.getTrailer());
              textFieldLoadNo.setText(d.getLoadNo());
              textFieldUserID.setText(d.getUserID());

              textFieldNoOfPallets.setText(Integer.toString(d.getTotalPallets()));
              setConfirmButtonStatus();
              setFindButtonStatus(d.getLocationIDFrom());

              populateAssignedList(d.getDespatchNo(), "");
              clearUnAssignedList();
            }
          }
          else
          {
            blankDespatchFields();
          }
        }
        else
        {
          jButtonLookupLocationFrom.setEnabled(false);
          buttonSetUserID.setEnabled(false);
          jButtonLookupLocationTo.setEnabled(false);
          jButtonLookupTrailer.setEnabled(false);
          jButtonLookupHaulier.setEnabled(false);
          buttonUnAssign.setEnabled(false);
          buttonAssign.setEnabled(false);
          populateAssignedList("", "");
        }
      }
    });
    list_despatch.setCellRenderer(Common.renderer_list);
    list_despatch.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(list_despatch);

    final JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(510, 30, 150, 345);
    desktopPane.add(scrollPane_1);

    list_unassigned = new JList4j();
    list_unassigned.setLocation(0, -3);
    list_unassigned.setCellRenderer(Common.renderer_list_unassigned);
    list_unassigned.setBackground(Common.color_list_unassigned);
    scrollPane_1.setViewportView(list_unassigned);

    final JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(310, 30, 150, 345);
    desktopPane.add(scrollPane_2);

    list_assigned = new JList4j();
    list_assigned.setCellRenderer(Common.renderer_list_assigned);
    list_assigned.setBackground(Common.color_list_assigned);
    scrollPane_2.setViewportView(list_assigned);

    comboBoxPalletStatus = new JComboBox();

    comboBoxPalletStatus.setFont(Common.font_std);
    comboBoxPalletStatus.setBounds(672, 135, 143, 21);

    ComboBoxModel jComboBoxDefaultPalletStatusModel = new DefaultComboBoxModel(Common.palletStatusIncBlank);
    comboBoxPalletStatus.setModel(jComboBoxDefaultPalletStatusModel);
    comboBoxPalletStatus.setSelectedIndex(0);
    desktopPane.add(comboBoxPalletStatus);

    textFieldSSCC = new JTextField4j();
    textFieldSSCC.setBounds(672, 50, 143, 21);
    desktopPane.add(textFieldSSCC);

    final JLabel4j_std palletStatusLabel = new JLabel4j_std();
    palletStatusLabel.setText(lang.get("lbl_Pallet_Status"));
    palletStatusLabel.setBounds(672, 115, 128, 20);
    desktopPane.add(palletStatusLabel);

    final JLabel4j_std ssccLabel = new JLabel4j_std();
    ssccLabel.setText(lang.get("lbl_Pallet_SSCC"));
    ssccLabel.setBounds(672, 35, 128, 16);
    desktopPane.add(ssccLabel);

    textFieldMaterial = new JTextField4j();
    textFieldMaterial.setBounds(672, 90, 124, 21);
    desktopPane.add(textFieldMaterial);

    final JLabel4j_std materialLabel = new JLabel4j_std();
    materialLabel.setText(lang.get("lbl_Material"));
    materialLabel.setBounds(672, 75, 128, 16);
    desktopPane.add(materialLabel);

    textFieldBatch = new JTextField4j();
    textFieldBatch.setBounds(672, 175, 124, 21);
    desktopPane.add(textFieldBatch);

    final JLabel4j_std batchLabel = new JLabel4j_std();
    batchLabel.setText(lang.get("lbl_Batch"));
    batchLabel.setBounds(672, 160, 128, 16);
    desktopPane.add(batchLabel);
    buttonAssign.setEnabled(false);

    buttonAssign.setBounds(470, 150, 25, 25);
    buttonAssign.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (textFieldDespatchLocationTo.getText().equals(""))
        {
          jStatusText.setText("Please define Destination Location");
        }
        else
        {
          jStatusText.setText("");
          if (list_unassigned.getSelectedIndex() > -1)
          {
            String item = "";
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            for (int j = list_unassigned.getMaxSelectionIndex(); j >= list_unassigned.getMinSelectionIndex(); j--)
            {
              if (list_unassigned.isSelectedIndex(j))
              {
                item = (String) list_unassigned.getModel().getElementAt(j);

                if (d.assignSSCC(item))
                {
                  addtoList(assignedList, item);
                  removefromList(unassignedList, item);
                  jStatusText.setText("");
                }
                else
                {
                  jStatusText.setText(d.getErrorMessage());
                }
              }
            }

            list_assigned.setModel(addListtoModel(assignedList));
            list_unassigned.setModel(addListtoModel(unassignedList));
            textFieldNoOfPallets.setText(String.valueOf(assignedList.size()));

            d.setTotalPallets(assignedList.size());
            updateDespatch(d);
          }
        }
      }
    });
    desktopPane.add(buttonAssign);
    buttonUnAssign.setEnabled(false);

    buttonUnAssign.setBounds(470, 185, 25, 25);
    buttonUnAssign.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_assigned.getSelectedIndex() > -1)
        {
          String item = "";
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

          for (int j = list_assigned.getMaxSelectionIndex(); j >= list_assigned.getMinSelectionIndex(); j--)
          {
            if (list_assigned.isSelectedIndex(j))
            {
              item = (String) list_assigned.getModel().getElementAt(j);

              if (d.unassignSSCC(item))
              {
                removefromList(assignedList, item);
                addtoList(unassignedList, item);
              }
            }
          }

          list_assigned.setModel(addListtoModel(assignedList));
          list_unassigned.setModel(addListtoModel(unassignedList));
          textFieldNoOfPallets.setText(String.valueOf(assignedList.size()));

          d.setTotalPallets(assignedList.size());
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(buttonUnAssign);

    newButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Create"), lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION);

        if (question == 0)
        {
          JDBDespatch d = new JDBDespatch(Common.selectedHostID, Common.sessionID);
          String number = "";
          number = d.generateNewDespatchNo();

          if (number.equals("") == false)
          {

            if (d.create())
            {
              d.updateUserID(number, Common.userList.getUser(Common.sessionID).getUserId());
              populateDespatchList(number);
              setConfirmButtonStatus();
            }
            else
            {
              JUtility.errorBeep();
              JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
            }
          }
          else
          {
            JUtility.errorBeep();
            JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
          }
        }
      }
    });
    newButton.setText(lang.get("btn_New"));
    newButton.setBounds(2, 388, 116, 30);
    desktopPane.add(newButton);

    deleteButton.setText(lang.get("btn_Delete"));
    deleteButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Delete") + " " + d.getDespatchNo() + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION);

            if (question == 0)
            {
              d.delete();
              populateDespatchList("");
              setConfirmButtonStatus();
            }
          }
        }
      }
    });
    deleteButton.setBounds(238, 388, 116, 30);
    desktopPane.add(deleteButton);

    findButton.setText(lang.get("btn_Find"));
    findButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        buildUnassignedSQL();
        populateUnassignedList(listStatement, "");
      }
    });
    findButton.setBounds(672, 298, 143, 30);
    desktopPane.add(findButton);

    final JButton4j printButton = new JButton4j(Common.icon_report);
    printButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
            HashMap<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("p_despatch_no", d.getDespatchNo());
            JLaunchReport.runReport("RPT_DESPATCH", parameters, "", null, "");
          }
        }
      }
    });
    printButton.setText(lang.get("btn_Print"));
    printButton.setBounds(474, 388, 116, 30);
    desktopPane.add(printButton);

    jLabel10 = new JLabel4j_std();
    jLabel10.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    jLabel10.setHorizontalAlignment(SwingConstants.TRAILING);
    jLabel10.setText(lang.get("lbl_Limit"));
    jLabel10.setBounds(672, 244, 128, 21);
    desktopPane.add(jLabel10);

    jCheckBoxLimit = new JCheckBox();
    jCheckBoxLimit.setSelected(true);
    jCheckBoxLimit.setBackground(new Color(255, 255, 255));
    jCheckBoxLimit.setBounds(672, 264, 21, 21);
    desktopPane.add(jCheckBoxLimit);

    spinnerUnassignedLimit = new JSpinner();
    JSpinner.NumberEditor ne1 = new JSpinner.NumberEditor(spinnerUnassignedLimit);
    ne1.getTextField().setFont(Common.font_std);
    spinnerUnassignedLimit.setEditor(ne1);
    spinnerUnassignedLimit.setBounds(701, 264, 114, 20);
    spinnerUnassignedLimit.setValue(1000);
    desktopPane.add(spinnerUnassignedLimit);

    final JButton4j closeButton = new JButton4j(Common.icon_close);

    closeButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dispose();
      }
    });
    closeButton.setText(lang.get("btn_Close"));
    closeButton.setMnemonic(lang.getMnemonicChar());
    closeButton.setBounds(710, 388, 116, 30);
    desktopPane.add(closeButton);

    jButtonHelp.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
      }
    });
    jButtonHelp.setText(lang.get("btn_Help"));
    jButtonHelp.setBounds(592, 388, 116, 30);
    desktopPane.add(jButtonHelp);

    //
    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_ADMIN_DESPATCH"));

    confirmButton.setText(lang.get("btn_Confirm"));
    confirmButton.setEnabled(false);
    confirmButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (list_despatch.getModel().getSize() > 0)
        {
          if (list_despatch.getSelectedIndex() >= 0)
          {
            JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

            int n = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Despatch_Confirm") + " " + d.getDespatchNo() + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION);

            if (n == 0)
            {
              d.getDespatchProperties();
              if (d.confirm())
              {
                populateDespatchList("");
                setConfirmButtonStatus();
              }
              else
              {
                JUtility.errorBeep();
                JOptionPane.showMessageDialog(Common.mainForm, d.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
                populateDespatchList("");
              }
            }
          }
        }
      }
    });

    confirmButton.setBounds(356, 388, 116, 30);
    desktopPane.add(confirmButton);

    final JLabel4j_title despatchesLabel = new JLabel4j_title();
    despatchesLabel.setText(lang.get("lbl_Despatches"));
    despatchesLabel.setBounds(10, 10, 75, 16);
    desktopPane.add(despatchesLabel);

    final JLabel4j_title unassignedLabel = new JLabel4j_title();
    unassignedLabel.setText(lang.get("lbl_Unassigned"));
    unassignedLabel.setBounds(510, 10, 150, 16);
    desktopPane.add(unassignedLabel);

    final JLabel4j_title assignedLabel = new JLabel4j_title();
    assignedLabel.setText(lang.get("lbl_Assigned"));
    assignedLabel.setBounds(310, 10, 150, 16);
    desktopPane.add(assignedLabel);

    final JLabel4j_title palletFilterCriteriaLabel = new JLabel4j_title();
    palletFilterCriteriaLabel.setText(lang.get("lbl_Unassigned_Filter"));
    palletFilterCriteriaLabel.setBounds(672, 15, 125, 16);
    desktopPane.add(palletFilterCriteriaLabel);

    final JButton4j refreshButton = new JButton4j(Common.icon_refresh);
    refreshButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        refresh();
      }
    });
    refreshButton.setText(lang.get("btn_Refresh"));
    refreshButton.setBounds(120, 388, 116, 30);
    desktopPane.add(refreshButton);

    SpinnerNumberModel jSpinnerIntModel = new SpinnerNumberModel();
    jSpinnerIntModel.setMinimum(1);
    jSpinnerIntModel.setMaximum(50000);
    jSpinnerIntModel.setStepSize(1);
    JSpinner.NumberEditor ne2 = new JSpinner.NumberEditor(spinnerDespatchLimit);
    ne2.getTextField().setFont(Common.font_std);
    spinnerDespatchLimit.setEditor(ne2);
    spinnerDespatchLimit.setModel(jSpinnerIntModel);
    spinnerDespatchLimit.setBounds(100, 303, 60, 20);
    spinnerDespatchLimit.setValue(50);
    desktopPane.add(spinnerDespatchLimit);

    jLabel10_1 = new JLabel4j_std();
    jLabel10_1.setHorizontalAlignment(SwingConstants.TRAILING);
    jLabel10_1.setText(lang.get("lbl_Limit"));
    jLabel10_1.setBounds(15, 302, 70, 21);
    desktopPane.add(jLabel10_1);

    textFieldDespatchLocationFrom = new JTextField4j();
    textFieldDespatchLocationFrom.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (JUtility.isNullORBlank(textFieldDespatchLocationFrom.getText()) == true)
        {
          findButton.setEnabled(false);
        }
        else
        {
          findButton.setEnabled(true);
        }
      }
    });
    textFieldDespatchLocationFrom.setEditable(false);
    textFieldDespatchLocationFrom.setBounds(172, 51, 105, 20);
    desktopPane.add(textFieldDespatchLocationFrom);

    final JLabel4j_std locationLabel_1 = new JLabel4j_std();
    locationLabel_1.setText(lang.get("lbl_From_Location"));
    locationLabel_1.setBounds(172, 32, 100, 16);
    desktopPane.add(locationLabel_1);

    final JLabel4j_std palletStatusLabel_1 = new JLabel4j_std();
    palletStatusLabel_1.setText(lang.get("lbl_Despatch_Status"));
    palletStatusLabel_1.setBounds(170, 240, 105, 20);
    desktopPane.add(palletStatusLabel_1);

    textFieldDespatchStatus = new JTextField4j();
    textFieldDespatchStatus.setEditable(false);
    textFieldDespatchStatus.setBounds(170, 261, 128, 20);
    desktopPane.add(textFieldDespatchStatus);

    textFieldDespatchLocationTo = new JTextField4j();
    textFieldDespatchLocationTo.setEditable(false);
    textFieldDespatchLocationTo.setBounds(172, 91, 105, 20);
    desktopPane.add(textFieldDespatchLocationTo);

    final JLabel4j_std locationLabel_1_1 = new JLabel4j_std();
    locationLabel_1_1.setText(lang.get("lbl_To_Location"));
    locationLabel_1_1.setBounds(172, 75, 100, 16);
    desktopPane.add(locationLabel_1_1);

    final JLabel4j_std palletStatusLabel_1_1 = new JLabel4j_std();
    palletStatusLabel_1_1.setText(lang.get("lbl_Despatch_Date"));
    palletStatusLabel_1_1.setBounds(172, 285, 90, 20);
    desktopPane.add(palletStatusLabel_1_1);

    final JLabel4j_std palletStatusLabel_1_1_1 = new JLabel4j_std();
    palletStatusLabel_1_1_1.setText(lang.get("lbl_No_Of_Pallets"));
    palletStatusLabel_1_1_1.setBounds(172, 332, 120, 20);
    desktopPane.add(palletStatusLabel_1_1_1);

    textFieldNoOfPallets = new JTextField4j();
    textFieldNoOfPallets.setEditable(false);
    textFieldNoOfPallets.setBounds(172, 352, 60, 20);
    desktopPane.add(textFieldNoOfPallets);

    jTextFieldDespatchDate = new JTextField4j();
    jTextFieldDespatchDate.setEditable(false);
    jTextFieldDespatchDate.setBounds(172, 303, 125, 20);
    desktopPane.add(jTextFieldDespatchDate);

    jButtonLookupLocationFrom = new JButton4j(Common.icon_lookup);
    jButtonLookupLocationFrom.setEnabled(false);
    jButtonLookupLocationFrom.setBounds(277, 50, 21, 21);
    jButtonLookupLocationFrom.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "Y";

        if (JLaunchLookup.locations())
        {
          textFieldDespatchLocationFrom.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLocationIDFrom(JLaunchLookup.dlgResult);
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(jButtonLookupLocationFrom);

    jButtonLookupLocationTo = new JButton4j(Common.icon_lookup);
    jButtonLookupLocationTo.setEnabled(false);
    jButtonLookupLocationTo.setBounds(277, 90, 21, 21);
    jButtonLookupLocationTo.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "Y";

        if (JLaunchLookup.locations())
        {
          textFieldDespatchLocationTo.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLocationIDTo(JLaunchLookup.dlgResult);
          updateDespatch(d);
        }
      }
    });
    desktopPane.add(jButtonLookupLocationTo);

    jButtonLookupMaterial = new JButton4j(Common.icon_lookup);
    jButtonLookupMaterial.setBounds(795, 90, 21, 21);
    jButtonLookupMaterial.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgAutoExec = false;
        JLaunchLookup.dlgCriteriaDefault = "";

        if (JLaunchLookup.materials())
        {
          textFieldMaterial.setText(JLaunchLookup.dlgResult);
        }
      }
    });
    desktopPane.add(jButtonLookupMaterial);

    jButtonLookupBatch = new JButton4j(Common.icon_lookup);
    jButtonLookupBatch.setBounds(795, 175, 21, 21);
    jButtonLookupBatch.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JLaunchLookup.dlgCriteriaDefault = textFieldMaterial.getText();
        JLaunchLookup.dlgAutoExec = true;

        if (JLaunchLookup.materialBatches())
        {
          textFieldBatch.setText(JLaunchLookup.dlgResult);
        }
      }
    });
    desktopPane.add(jButtonLookupBatch);

    confirmedRadioButton.setBackground(Color.WHITE);
    confirmedRadioButton.setText(lang.get("lbl_Confirmed"));
    confirmedRadioButton.setBounds(10, 327, 129, 24);
    confirmedRadioButton.setFont(Common.font_std);
    confirmedRadioButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        com.commander4j.util.JWait.milliSec(100);
        populateDespatchList("");
        refresh();
      }
    });

    desktopPane.add(confirmedRadioButton);

    unconfirmedRadioButton.setBackground(Color.WHITE);
    unconfirmedRadioButton.setText(lang.get("lbl_Unconfirmed"));
    unconfirmedRadioButton.setBounds(10, 352, 129, 24);
    unconfirmedRadioButton.setSelected(true);
    unconfirmedRadioButton.setFont(Common.font_std);
    unconfirmedRadioButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        com.commander4j.util.JWait.milliSec(100);
        populateDespatchList("");
        refresh();
        newButton.setEnabled(true);
      }
    });
    desktopPane.add(unconfirmedRadioButton);

    buttonGroup_1.add(unconfirmedRadioButton);
    buttonGroup_1.add(confirmedRadioButton);

    final JLabel4j_std palletStatusLabel_1_2 = new JLabel4j_std();
    palletStatusLabel_1_2.setText(lang.get("lbl_Trailer"));
    palletStatusLabel_1_2.setBounds(172, 115, 105, 20);
    desktopPane.add(palletStatusLabel_1_2);

    textFieldTrailer = new JTextField4j();
    textFieldTrailer.setEditable(false);
    textFieldTrailer.setBounds(172, 136, 105, 20);

    desktopPane.add(textFieldTrailer);

    final JLabel4j_std palletStatusLabel_1_2_1 = new JLabel4j_std();
    palletStatusLabel_1_2_1.setText(lang.get("lbl_Haulier"));
    palletStatusLabel_1_2_1.setBounds(172, 158, 105, 20);
    desktopPane.add(palletStatusLabel_1_2_1);

    textFieldHaulier = new JTextField4j();
    textFieldHaulier.setEditable(false);
    textFieldHaulier.setBounds(172, 176, 105, 20);
    desktopPane.add(textFieldHaulier);

    jButtonLookupTrailer = new JButton4j();
    jButtonLookupTrailer.setEnabled(false);
    jButtonLookupTrailer.setText("...");
    jButtonLookupTrailer.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        String trailer;
        trailer = JOptionPane.showInputDialog(Common.mainForm, "Enter Trailer Reference");

        if (trailer != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setTrailer(trailer.toUpperCase());
          textFieldTrailer.setText(trailer.toUpperCase());
          updateDespatch(d);
        }
      }
    });
    jButtonLookupTrailer.setBounds(277, 135, 21, 21);
    desktopPane.add(jButtonLookupTrailer);

    jButtonLookupHaulier = new JButton4j();
    jButtonLookupHaulier.setEnabled(false);
    jButtonLookupHaulier.setText("...");
    jButtonLookupHaulier.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        String haulier;
        haulier = JOptionPane.showInputDialog(Common.mainForm, "Enter Haulier Reference");

        if (haulier != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setHaulier(haulier.toUpperCase());
          textFieldHaulier.setText(haulier.toUpperCase());
          updateDespatch(d);
        }
      }
    });
    jButtonLookupHaulier.setBounds(277, 175, 21, 21);
    desktopPane.add(jButtonLookupHaulier);

    jStatusText = new JLabel4j_std("");
    jStatusText.setBounds(0, 428, 830, 21);
    jStatusText.setForeground(new java.awt.Color(255, 0, 0));
    jStatusText.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    desktopPane.add(jStatusText);

    JLabel4j_std lblLoadNo = new JLabel4j_std();
    lblLoadNo.setText(lang.get("lbl_Load_No"));
    lblLoadNo.setBounds(172, 196, 105, 20);
    desktopPane.add(lblLoadNo);

    textFieldLoadNo = new JTextField4j();
    textFieldLoadNo.setText("");
    textFieldLoadNo.setEditable(false);
    textFieldLoadNo.setBounds(172, 216, 105, 20);
    desktopPane.add(textFieldLoadNo);

    jButtonLookupLoadNo = new JButton4j();
    jButtonLookupLoadNo.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent arg0)
      {
        String load;
        load = JOptionPane.showInputDialog(Common.mainForm, "Enter Load Number");

        if (load != null)
        {
          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.setLoadNo(load.toUpperCase());
          textFieldLoadNo.setText(load.toUpperCase());
          updateDespatch(d);

        }

      }
    });
    jButtonLookupLoadNo.setText("...");
    jButtonLookupLoadNo.setEnabled(false);
    jButtonLookupLoadNo.setBounds(277, 215, 21, 21);
    desktopPane.add(jButtonLookupLoadNo);

    JLabel4j_std label = new JLabel4j_std();
    label.setText(lang.get("lbl_User_ID"));
    label.setBounds(672, 338, 128, 16);
    desktopPane.add(label);

    textFieldUserID = new JTextField4j();
    textFieldUserID.setText("");
    textFieldUserID.setEditable(false);
    textFieldUserID.setBounds(672, 356, 122, 20);
    desktopPane.add(textFieldUserID);

    buttonSetUserID = new JButton4j((Icon) null);
    buttonSetUserID.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JLaunchLookup.dlgAutoExec = true;
        JLaunchLookup.dlgCriteriaDefault = "";

        if (JLaunchLookup.users())
        {
          textFieldUserID.setText(JLaunchLookup.dlgResult);

          JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
          d.updateUserID(d.getDespatchNo(), JLaunchLookup.dlgResult);

        }
      }
    });
    buttonSetUserID.setEnabled(false);
View Full Code Here

  {
    if (list_despatch.getModel().getSize() > 0)
    {
      if (list_despatch.getSelectedIndex() >= 0)
      {
        JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
        previousdespatchno = "";
        populateDespatchList(d.getDespatchNo());
      }
    }
  }
View Full Code Here

    if (list_despatch.getModel().getSize() > 0)
    {
      if (list_despatch.getSelectedIndex() >= 0)
      {
        JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();

        q.addParamtoSQL("despatch_no <> ", d.getDespatchNo());

      }
    }

    if (textFieldDespatchNo.getText().equals("") == false)
View Full Code Here

  {
    int counter = 0;

    DefaultComboBoxModel DefComboBoxMod = new DefaultComboBoxModel();

    JDBDespatch temp = new JDBDespatch(Common.selectedHostID, Common.sessionID);
    assignedList.clear();
    assignedList.addAll(temp.getAssignedSSCCs(despatchno));

    int sel = -1;

    if (despatchno.isEmpty() == false)
    {
View Full Code Here

  public String buildDespatchList(String status, String defaultItem, int currentPage) {

    String result = "";
    String selected = "";

    JDBDespatch desp = new JDBDespatch(getHostID(), getSessionID());
    LinkedList<JDBDespatch> list = new LinkedList<JDBDespatch>();

    checkedIndex = -1;
    despatchCount = 0;

    list = desp.browseDespatchData(status, 9999);
   
    list = paginateList(list,currentPage,8);
   
    if (list.size() > 0)
    {
View Full Code Here

    JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
    JDBUom uoml = new JDBUom(getHostID(), getSessionID());
    inter.getInterfaceProperties("Despatch Confirmation", "Output");
    String device = inter.getDevice();
   
    JDBDespatch desp = new JDBDespatch(getHostID(), getSessionID());
    desp.setTransactionRef(transactionRef);
    desp.getDespatchPropertiesFromTransactionRef();

    String sourceGLN = JUtility.replaceNullStringwithBlank(desp.getLocationDBFrom().getGLN());
    String destinationGLN = JUtility.replaceNullStringwithBlank(desp.getLocationDBTo().getGLN());
    Boolean suppressMessage = false;

    gmh.setMessageRef(desp.getTransactionRef().toString());
    gmh.setInterfaceType(inter.getInterfaceType());
    gmh.setMessageInformation("Despatch=" + desp.getDespatchNo());
    gmh.setInterfaceDirection(inter.getInterfaceDirection());
    gmh.setMessageDate(JUtility.getISOTimeStampStringFormat(JUtility.getSQLDateTime()));

    if (sourceGLN.length() == 0)
    {
      setErrorMessage("Message Suppressed - No GLN Source (From) GLN for Location [" + desp.getLocationIDFrom() + "]");
      suppressMessage = true;
    }

    if (destinationGLN.length() == 0)
    {
      setErrorMessage("Message Suppressed - No GLN Destination (To) GLN for Location [" + desp.getLocationIDTo() + "]");
      suppressMessage = true;
    }

    if (suppressMessage == true)
    {
      result = true;
      il.write(gmh, GenericMessageHeader.msgStatusWarning, getErrorMessage(), "File Write", "");

    }
    else
    {
      if (inter.getFormat().equals("EANCOM"))
      {

        if (sourceGLN.endsWith(""))
        {

        }

        int segments = 0;
        int optional = 0;
        String document = "";
        String despdateShort = new java.text.SimpleDateFormat("yyMMdd:HHmm").format(desp.getDespatchDate());
        String despdateLong = new java.text.SimpleDateFormat("yyyyMMddHHmm").format(desp.getDespatchDate());

        document = document + "UNA:+.? 'UNB+UNOA:3+" + desp.getLocationDBFrom().getGLN() + ":14+" + desp.getLocationDBTo().getGLN() + ":14+";
        document = document + despdateShort + "+" + desp.getDespatchNo() + "'";
        document = document + "UNH+" + desp.getDespatchNo() + "+DESADV:D:96A:EN:EAN005'";
        document = document + "BGM+351+" + desp.getDespatchNo() + "+9'";
        document = document + "DTM+11:" + despdateLong + ":203'";
        document = document + "RFF+LO:" + desp.getDespatchNo() + "'";
        document = document + "RFF+ZCO:'";
        document = document + "RFF+ZAF:'";
        document = document + "RFF+ZPI:1'";
        document = document + "RFF+ZCH:'";
        document = document + "NAD+SF+" + desp.getLocationDBFrom().getGLN() + "::9'";

        if (desp.getLocationDBFrom().getStorageLocation().equals("") == false)
        {
          if (desp.getLocationDBTo().getStorageLocation().equals("") == false)
          {
            document = document + "LOC+198+" + desp.getLocationDBFrom().getStorageLocation() + "::91'";
            optional++;
          }
        }

        document = document + "NAD+ST+" + desp.getLocationDBTo().getGLN() + "::9'";

        if (desp.getLocationDBFrom().getStorageLocation().equals("") == false)
        {
          if (desp.getLocationDBTo().getStorageLocation().equals("") == false)
          {
            document = document + "LOC+195+" + desp.getLocationDBTo().getStorageLocation() + "::91'";
            optional++;
          }
        }

        document = document + "TDT+20++30+31+::9:" + JUtility.stripEANCOMSpecialCharacters(JUtility.replaceNullStringwithBlank(desp.getHaulier())) + "+++:::" + JUtility.stripEANCOMSpecialCharacters(JUtility.replaceNullStringwithBlank(desp.getTrailer())) + "'";
        document = document + "EQD+CN+123'";
        document = document + "SEL+123+CA'";

        segments = 13 + optional;

        JDBPalletHistory palhist = new JDBPalletHistory(getHostID(), getSessionID());
        ResultSet rs = palhist.getInterfacingData(transactionRef, "DESPATCH", "TO", Long.valueOf(0), "SSCC", "asc");

        int x = 1;
        try
        {
          rs.beforeFirst();
          while (rs.next())
          {
            palhist.getPropertiesfromResultSet(rs);

            document = document + "CPS+" + JUtility.padString(String.valueOf(x).trim(), false, 4, "0") + "'";
            document = document + "PAC+1++202'";
            document = document + "PCI+33E'";
            document = document + "GIN+BJ+" + palhist.getPallet().getSSCC() + "'";
            document = document + "LIN+1++" + palhist.getPallet().getEAN() + ":EN'";
            document = document + "PIA+1+" + palhist.getPallet().getVariant() + ":PV+" + palhist.getPallet().getMaterial() + ":SA'";

            NumberFormat formatter = new DecimalFormat("#.#");
            String outqty = formatter.format(palhist.getPallet().getQuantity()); // -1234.567000

            document = document + "QTY+12:" + outqty + ":" + palhist.getPallet().getUom() + "'";
            document = document + "DLM+++0::9'";

            String batchExpiryLong = new java.text.SimpleDateFormat("yyyyMMdd").format(palhist.getPallet().getMaterialBatchExpiryDate());
            String dateOfManufactureLong = new java.text.SimpleDateFormat("yyyyMMdd").format(palhist.getPallet().getDateOfManufacture());

            document = document + "DTM+361:" + batchExpiryLong + ":102'";
            document = document + "DTM+94:" + dateOfManufactureLong + ":102'";
            document = document + "RFF+AAJ:" + palhist.getPallet().getDespatchNo() + ":1'";
           
            defaultBatchStatus = palhist.getPallet().getMaterialBatchStatus();
           
            if (defaultBatchStatus.equals("Unrestricted"))
            {
              document = document + "RFF+ZBR:'";
            }
            else
            {
              document = document + "RFF+ZBR:B'";
            }

            document = document + "RFF+ZRB:'";
            document = document + "RFF+ZSR:'";
            document = document + "RFF+ZRC:'";
            document = document + "RFF+ZRT:'";
            document = document + "PCI+36E'";
            document = document + "GIN+BX+" + palhist.getPallet().getBatchNumber() + "'";

            segments = segments + 18;

            x++;
          }
          rs.close();

          segments = segments + 1;

          document = document + "UNT+" + String.valueOf(segments).trim() + "+" + desp.getDespatchNo() + "'";
          document = document + "UNZ+1+" + desp.getDespatchNo() + "'";

          if (device.equals("Disk") | device.equals("Email"))
          {
            path = inter.getRealPath();
            if (fio.writeToDisk(path, document, transactionRef, "_"+desp.getLocationIDTo().replace(" ", "_")+"_DespatchConfirmation.txt") == true)
            {
              result = true;
              il.write(gmh, GenericMessageHeader.msgStatusSuccess, "Processed OK", "File Write", fio.getFilename());
              setErrorMessage("");
              if (device.equals("Email"))
              {
                ogm = new JeMailOutGoingMessage(inter,transactionRef,fio);
                ogm.sendEmail();
              }
            }
            else
            {
              result = false;
              il.write(gmh, GenericMessageHeader.msgStatusError, fio.getErrorMessage(), "File Write", fio.getFilename());
              setErrorMessage(fio.getErrorMessage());
            }

          }

        }
        catch (SQLException e)
        {

        }

      }

      if (inter.getFormat().equals("XML"))
      {

        try
        {
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();

          Document document = builder.newDocument();

          Element message = (Element) document.createElement("message");

          Element hostUniqueID = addElement(document, "hostRef", Common.hostList.getHost(getHostID()).getUniqueID());
          message.appendChild(hostUniqueID);

          Element messageRef = addElement(document, "messageRef", String.valueOf(transactionRef));
          message.appendChild(messageRef);

          Element messageType = addElement(document, "interfaceType", "Despatch Confirmation");
          message.appendChild(messageType);

          Element messageInformation = addElement(document, "messageInformation", "Despatch=" + desp.getDespatchNo());
          message.appendChild(messageInformation);

          Element messageDirection = addElement(document, "interfaceDirection", "Output");
          message.appendChild(messageDirection);

          Element messageDate = addElement(document, "messageDate", JUtility.getISOTimeStampStringFormat(JUtility.getSQLDateTime()));
          message.appendChild(messageDate);

          Element despatchConfirmation = (Element) document.createElement("despatchConfirmation");

          Element noofpallets = addElement(document, "numberOfPallets", String.valueOf(desp.getTotalPallets()));
          despatchConfirmation.appendChild(noofpallets);

          Element haulier = addElement(document, "haulier", String.valueOf(JUtility.replaceNullStringwithBlank(desp.getHaulier())));
          despatchConfirmation.appendChild(haulier);

          Element trailer = addElement(document, "trailer", String.valueOf(JUtility.replaceNullStringwithBlank(desp.getTrailer())));
          despatchConfirmation.appendChild(trailer);

          Element despatch = addElement(document, "despatchNo", desp.getDespatchNo());
          despatchConfirmation.appendChild(despatch);

          Element despatchDate = addElement(document, "despatchDate", JUtility.getISOTimeStampStringFormat(desp.getDespatchDate()));
          despatchConfirmation.appendChild(despatchDate);

          Element locationFrom = addElement(document, "fromLocation", desp.getLocationIDFrom());
          despatchConfirmation.appendChild(locationFrom);

          Element locationFromPlant = addElement(document, "fromPlant", desp.getLocationDBFrom().getPlant());
          despatchConfirmation.appendChild(locationFromPlant);
         
          Element locationFromWarehouse = addElement(document, "fromWarehouse", desp.getLocationDBFrom().getWarehouse());
          despatchConfirmation.appendChild(locationFromWarehouse);
         
          Element locationFromStorageSection = addElement(document, "fromStorageSection", desp.getLocationDBFrom().getStorageSection());
          despatchConfirmation.appendChild(locationFromStorageSection);
         
          Element locationFromStorageType = addElement(document, "fromStorageType", desp.getLocationDBFrom().getStorageType());
          despatchConfirmation.appendChild(locationFromStorageType);
         
          Element locationFromStorageBin = addElement(document, "fromStorageBin", desp.getLocationDBFrom().getStorageBin());
          despatchConfirmation.appendChild(locationFromStorageBin);   
         
         
         
          Element locationFromGLN = addElement(document, "fromGLN", desp.getLocationDBFrom().getGLN());
          despatchConfirmation.appendChild(locationFromGLN);

          Element locationFromStorageLocation = addElement(document, "fromStorageLocation", desp.getLocationDBFrom().getStorageLocation());
          despatchConfirmation.appendChild(locationFromStorageLocation);

          Element locationTo = addElement(document, "toLocation", desp.getLocationIDTo());
          despatchConfirmation.appendChild(locationTo);

          Element locationToPlant = addElement(document, "toPlant", desp.getLocationDBTo().getPlant());
          despatchConfirmation.appendChild(locationToPlant);
         
          Element locationToWarehouse = addElement(document, "toWarehouse", desp.getLocationDBTo().getWarehouse());
          despatchConfirmation.appendChild(locationToWarehouse)
         
          Element locationToStorageSection = addElement(document, "toStorageSection", desp.getLocationDBTo().getStorageSection());
          despatchConfirmation.appendChild(locationToStorageSection);
         
          Element locationToStorageType = addElement(document, "toStorageType", desp.getLocationDBTo().getStorageType());
          despatchConfirmation.appendChild(locationToStorageType);
         
          Element locationToStorageBin = addElement(document, "toStorageBin", desp.getLocationDBTo().getStorageBin());
          despatchConfirmation.appendChild(locationToStorageBin);           
         
          Element locationToGLN = addElement(document, "toGLN", desp.getLocationDBTo().getGLN());
          despatchConfirmation.appendChild(locationToGLN);

          Element locationToStorageLocation = addElement(document, "toStorageLocation", desp.getLocationDBTo().getStorageLocation());
          despatchConfirmation.appendChild(locationToStorageLocation);

          Element contents = (Element) document.createElement("contents");
          despatchConfirmation.appendChild(contents);

          JDBPalletHistory palhist = new JDBPalletHistory(getHostID(), getSessionID());
          ResultSet rs = palhist.getInterfacingData(transactionRef, "DESPATCH", "TO", Long.valueOf(0), "SSCC", "asc");

          int x = 1;
          try
          {
            rs.beforeFirst();
            while (rs.next())
            {
              palhist.getPropertiesfromResultSet(rs);
              Element pallet = (Element) document.createElement("pallet");

              Element item = addElement(document, "item", String.valueOf(x));
              pallet.appendChild(item);
              x++;

              Element sscc = addElement(document, "SSCC", palhist.getPallet().getSSCC());
              pallet.appendChild(sscc);

              Element processOrder = addElement(document, "processOrder", palhist.getPallet().getProcessOrder());
              pallet.appendChild(processOrder);
             
              Element material = addElement(document, "material", palhist.getPallet().getMaterial());
              pallet.appendChild(material);

              Element ean = addElement(document, "ean", palhist.getPallet().getEAN());
              pallet.appendChild(ean);

              Element variant = addElement(document, "variant", palhist.getPallet().getVariant());
              pallet.appendChild(variant);

              Element qty = addElement(document, "quantity", palhist.getPallet().getQuantity().toString());
              pallet.appendChild(qty);

              String paluom = palhist.getPallet().getUom();
              paluom = uoml.convertUom(inter.getUOMConversion(), paluom);

              Element uom = addElement(document, "UOM", paluom);
              pallet.appendChild(uom);

              Element status = addElement(document, "status", palhist.getPallet().getStatus());
              pallet.appendChild(status);

              Element bbe = addElement(document, "bestBefore", JUtility.getISOTimeStampStringFormat(palhist.getPallet().getMaterialBatchExpiryDate()));
              pallet.appendChild(bbe);

              Element dom = addElement(document, "productionDate", JUtility.getISOTimeStampStringFormat(palhist.getPallet().getDateOfManufacture()));
              pallet.appendChild(dom);

              Element batch = addElement(document, "batch", palhist.getPallet().getBatchNumber());
              pallet.appendChild(batch);

              Element batchStatus = addElement(document, "batchStatus", palhist.getPallet().getMaterialBatchStatus());
              pallet.appendChild(batchStatus);

              contents.appendChild(pallet);

            }
            rs.close();
          }
          catch (SQLException e)
          {

          }

          Element messageData = (Element) document.createElement("messageData");
          messageData.appendChild(despatchConfirmation);

          message.appendChild(messageData);

          document.appendChild(message);

 

          JXMLDocument xmld = new JXMLDocument();
          xmld.setDocument(document);
          gmh.decodeHeader(xmld);

          if (device.equals("Disk") | device.equals("Email"))
          {
            path = inter.getRealPath();
            if (fio.writeToDisk(path, document, transactionRef, "_"+desp.getLocationIDTo().replace(" ", "_")+"_DespatchConfirmation.xml") == true)
            {
              result = true;
              il.write(gmh, GenericMessageHeader.msgStatusSuccess, "Processed OK", "File Write", fio.getFilename());
              setErrorMessage("");
             
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBDespatch

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.