Package com.commander4j.db

Examples of com.commander4j.db.JDBMHNReasons


    JDBPalletHistory palhistto = new JDBPalletHistory(getHostID(), getSessionID());
    JDBControl ctrl = new JDBControl(getHostID(), getSessionID());
   
    String origin = ctrl.getKeyValue("DEFAULT_LOCATION");
    JDBMHN mhn = new JDBMHN(getHostID(), getSessionID());
    JDBMHNReasons mhnReasons = new JDBMHNReasons(getHostID(), getSessionID());

    ResultSet rsFrom = palhistfrom.getInterfacingData(transactionRef, "STATUS CHANGE", "FROM", Long.valueOf(1), "SSCC", "asc");

    ResultSet rsTo = palhistfrom.getInterfacingData(transactionRef, "STATUS CHANGE", "TO", Long.valueOf(1), "SSCC", "asc");

    try
    {
      if (rsFrom.next())
      {
        if (rsTo.next())
        {
          palhistfrom.getPropertiesfromResultSet(rsFrom);
          palhistto.getPropertiesfromResultSet(rsTo);

          String mhnNumber = palhistto.getPallet().getMHNNumber();
          String initiator = "";
          String recorder = "";
          String authorisor = "";
          String decision = "";
          String reason1 = "";
          String reason2 = "";
          String reason3 = "";
          String dateCreated = "";
          String dateExpected = "";
          String dateResolved = "";
          String comment = "";
          String status = "";
          String locn = "";
          if (palhistto.getPallet().getMHNNumber().equals("") == false)
          {
            if (mhn.getMHNProperties(palhistto.getPallet().getMHNNumber()))
            {
              initiator = mhn.getInitiator();
              recorder = mhn.getRecorder();
              authorisor = mhn.getAuthorisor();
              reason1 = mhn.getReason1();
              reason2 = mhn.getReason2();
              reason3 = mhn.getReason3();
              dateCreated = JUtility.getISOTimeStampStringFormat(mhn.getDateCreated());
              if (dateCreated.equals("Error"))
                dateCreated = "";
              dateExpected = JUtility.getISOTimeStampStringFormat(mhn.getDateExpected());
              if (dateExpected.equals("Error"))
                dateExpected = "";
              dateResolved = JUtility.getISOTimeStampStringFormat(mhn.getDateResolved());
              if (dateResolved.equals("Error"))
                dateResolved = "";
              comment = mhn.getComments();
              status = mhn.getStatus();
            }
          }

          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", "Pallet Status Change");
            message.appendChild(messageType);

            Element messageInformation = addElement(document, "messageInformation", "SSCC=" + palhistto.getPallet().getSSCC());
            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 palletStatusChange = (Element) document.createElement("palletStatusChange");

            Element sscc = addElement(document, "SSCC", palhistto.getPallet().getSSCC());
            palletStatusChange.appendChild(sscc);
           
            Element material = addElement(document, "material", palhistto.getPallet().getMaterial());
            palletStatusChange.appendChild(material);

            Element batch = addElement(document, "batch", palhistto.getPallet().getBatchNumber());
            palletStatusChange.appendChild(batch);

            Element source = addElement(document,"origin",origin);
            palletStatusChange.appendChild(source);
           
            locn = palhistfrom.getPallet().getLocationID();
            Element location = addElement(document, "location", palhistto.getPallet().getLocationID());
            palletStatusChange.appendChild(location);
           
            Element quantity = addElement(document, "quantity", palhistto.getPallet().getQuantity().toString());
            palletStatusChange.appendChild(quantity);
           
            Element uom = addElement(document, "uom", palhistto.getPallet().getUom().toString());
            palletStatusChange.appendChild(uom);           
           
            Element despNo = addElement(document, "despatchNumber", palhistto.getPallet().getDespatchNo());
            palletStatusChange.appendChild(despNo)

            Element statusFrom = addElement(document, "statusFrom", palhistfrom.getPallet().getStatus());
            palletStatusChange.appendChild(statusFrom);

            Element statusTo = addElement(document, "statusTo", palhistto.getPallet().getStatus());
            palletStatusChange.appendChild(statusTo);
           
            decision =  palhistto.getPallet().getDecision();

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

            Element mhnNo = addElement(document, "MHN", mhnNumber);
            masterHoldNoticeData.appendChild(mhnNo);

            Element mhnRecorder = addElement(document, "recorder", recorder);
            masterHoldNoticeData.appendChild(mhnRecorder);

            Element mhnInitiator = addElement(document, "initiator", initiator);
            masterHoldNoticeData.appendChild(mhnInitiator);

            Element mhnAuthorisor = addElement(document, "authorisor", authorisor);
            masterHoldNoticeData.appendChild(mhnAuthorisor);
           
            Element mhnDecision = addElement(document, "decision", decision);
            masterHoldNoticeData.appendChild(mhnDecision);

            Element masterHoldReasons = (Element) document.createElement("reasons");

            if (reason1.equals("") == false)
            {
              Element masterHoldReason = (Element) document.createElement("reason");
              Element mhnReason1 = addElement(document, "code", reason1);
              masterHoldReason.appendChild(mhnReason1);
             
              mhnReasons.getReasonProperties(reason1);
              String reason1desc = mhnReasons.getDescription();
              Element mhnReason1desc = addElement(document, "description", reason1desc);
              masterHoldReason.appendChild(mhnReason1desc);
              masterHoldReasons.appendChild(masterHoldReason);
            }

            if (reason2.equals("") == false)
            {
              Element masterHoldReason = (Element) document.createElement("reason");
              Element mhnReason2 = addElement(document, "code", reason2);
              masterHoldReason.appendChild(mhnReason2);
             
              mhnReasons.getReasonProperties(reason2);
              String reason2desc = mhnReasons.getDescription();
              Element mhnReason2desc = addElement(document, "description", reason2desc);
              masterHoldReason.appendChild(mhnReason2desc);
              masterHoldReasons.appendChild(masterHoldReason);
            }

            if (reason3.equals("") == false)
            {
              Element masterHoldReason = (Element) document.createElement("reason");
              Element mhnReason3 = addElement(document, "code", reason3);
              masterHoldReason.appendChild(mhnReason3);
             
              mhnReasons.getReasonProperties(reason3);
              String reason3desc = mhnReasons.getDescription();
              Element mhnReason3desc = addElement(document, "description", reason3desc);
              masterHoldReason.appendChild(mhnReason3desc);
              masterHoldReasons.appendChild(masterHoldReason);
            }
View Full Code Here


        save();
      }
    });

    decisionList.addAll(mhnDecisions.getDecisions());
    reasonList.add(new JDBMHNReasons(Common.selectedHostID, Common.sessionID));
    reasonList.addAll(mhnReasons.getReasons());

    masterHoldNoticeNumber = mhnNumber;

    lang = new JDBLanguage(Common.selectedHostID, Common.sessionID);
View Full Code Here

    {
      lreason = ((JDBMHNReasons) jListReasons.getSelectedValue()).getReason();
      int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Reason_Delete") + " " + lreason + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);
      if (question == 0)
      {
        JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
        u.setReason(lreason);
        u.delete();
        populateList("");
      }
    }
  }
View Full Code Here

      if (lreason_to != null)
      {
        if (lreason_to.equals("") == false)
        {
          lreason_to = lreason_to.toUpperCase();
          JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
          u.setReason(lreason_from);
          if (u.renameTo(lreason_to) == false)
          {
            JUtility.errorBeep();
            JOptionPane.showMessageDialog(Common.mainForm, u.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE,Common.icon_confirm);
          }
          populateList(lreason_to);
        }
      }
    }
View Full Code Here

      }
    }
  }

  private void create() {
    JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
    lreason = JOptionPane.showInputDialog(Common.mainForm, lang.get("dlg_Reason_Add"));
    if (lreason != null)
    {
      if (lreason.equals("") == false)
      {
        lreason = lreason.toUpperCase();
        if (u.create(lreason, "") == false)
        {
          JUtility.errorBeep();
          JOptionPane.showMessageDialog(Common.mainForm, u.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE,Common.icon_confirm);
        }
        else
        {
          JLaunchMenu.runForm("FRM_ADMIN_MHN_REASON_EDIT", lreason);
        }
View Full Code Here

  private void populateList(String defaultitem) {

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

    JDBMHNReasons tempType = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
    Vector<JDBMHNReasons> tempTypeList = tempType.getReasons();
    int sel = -1;
    for (int j = 0; j < tempTypeList.size(); j++)
    {
      JDBMHNReasons t = (JDBMHNReasons) tempTypeList.get(j);
      DefComboBoxMod.addElement(t);
      if (t.getReason().equals(defaultitem))
      {
        sel = j;
      }
    }
View Full Code Here

        save();
      }
    });

    decisionList.addAll(mhnDecisions.getDecisions());
    reasonList.add(new JDBMHNReasons(Common.selectedHostID, Common.sessionID));
    reasonList.addAll(mhnReasons.getReasons());

    masterHoldNoticeNumber = mhnNumber;

    lang = new JDBLanguage(Common.selectedHostID, Common.sessionID);
View Full Code Here

    {
      lreason = ((JDBMHNReasons) jListReasons.getSelectedValue()).getReason();
      int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Reason_Delete") + " " + lreason + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION);
      if (question == 0)
      {
        JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
        u.setReason(lreason);
        u.delete();
        populateList("");
      }
    }
  }
View Full Code Here

      if (lreason_to != null)
      {
        if (lreason_to.equals("") == false)
        {
          lreason_to = lreason_to.toUpperCase();
          JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
          u.setReason(lreason_from);
          if (u.renameTo(lreason_to) == false)
          {
            JUtility.errorBeep();
            JOptionPane.showMessageDialog(Common.mainForm, u.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
          }
          populateList(lreason_to);
        }
      }
    }
View Full Code Here

      }
    }
  }

  private void create() {
    JDBMHNReasons u = new JDBMHNReasons(Common.selectedHostID, Common.sessionID);
    lreason = JOptionPane.showInputDialog(Common.mainForm, lang.get("dlg_Reason_Add"));
    if (lreason != null)
    {
      if (lreason.equals("") == false)
      {
        lreason = lreason.toUpperCase();
        if (u.create(lreason, "") == false)
        {
          JUtility.errorBeep();
          JOptionPane.showMessageDialog(Common.mainForm, u.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.ERROR_MESSAGE);
        }
        else
        {
          JLaunchMenu.runForm("FRM_ADMIN_MHN_REASON_EDIT", lreason);
        }
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBMHNReasons

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.