Package com.commander4j.db

Examples of com.commander4j.db.JDBUom


  public Boolean processMessage(GenericMessageHeader gmh) {
    Boolean result = false;

    JDBProcessOrder po = new JDBProcessOrder(getHostID(), getSessionID());
    JDBCustomer cst = new JDBCustomer(getHostID(), getSessionID());
    JDBUom uomdb = new JDBUom(getHostID(), getSessionID());
    JDBInterface inter = new JDBInterface(getHostID(), getSessionID());

    inter.getInterfaceProperties("Process Order", "Input");

    orderNo = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/orderNo").trim();
    material = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/material").trim();
    description = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/description").trim();
    status = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/status").trim();
    location = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/location").trim();
    dueDate = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/dueDate").trim();
    receipeId = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/receipeId").trim();
    requiredQuantity = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/requiredQuantity").trim();

    requiredUom = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/requiredUom").trim();
    requiredUom = uomdb.convertUom(inter.getUOMConversion(), requiredUom);

    defaultPalletStatus = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/defaultPalletStatus").trim();
    requiredResource = gmh.getXMLDocument().findXPath("//message/messageData/processOrder/requiredResource").trim();
   
    inspectionID = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/processOrder/inspectionID").trim());
View Full Code Here


    JDBMaterial mat = new JDBMaterial(getHostID(), getSessionID());
    JDBMaterialType mattype = new JDBMaterialType(getHostID(), getSessionID());
    JDBMaterialLocation matlocn = new JDBMaterialLocation(getHostID(), getSessionID());
    JDBLocation locn = new JDBLocation(getHostID(), getSessionID());
    JDBMaterialUom matuom = new JDBMaterialUom(getHostID(), getSessionID());
    JDBUom uomdb = new JDBUom(getHostID(), getSessionID());
    JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
    JDBControl ctrl = new JDBControl(getHostID(), getSessionID());
    JDBMaterialCustomerData matcustdata = new JDBMaterialCustomerData(getHostID(), getSessionID());
    JDBCustomer cust = new JDBCustomer(getHostID(), getSessionID());

    String defaultBatchStatus = ctrl.getKeyValue("DEFAULT BATCH STATUS");

    inter.getInterfaceProperties("Material Definition", "Input");

    material = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/material").trim());
    setErrorMessage("Material " + material + " updated.");
    materialType = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/materialType").trim());

    if (mattype.isValidMaterialType(materialType) == false)
    {
      mattype.create(materialType, materialType);
    }

    description = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/description").trim());
    base_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/base_uom").trim());
    base_uom = uomdb.convertUom(inter.getUOMConversion(), base_uom);

    production_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/production_uom").trim());
    production_uom = uomdb.convertUom(inter.getUOMConversion(), production_uom);

    issue_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/issue_uom").trim());
    issue_uom = uomdb.convertUom(inter.getUOMConversion(), issue_uom);

    shelf_life_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life_uom").trim());
    equipment_type = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/equipment_Type").trim());
    shelf_life = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life").trim());
    shelf_life_rule = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life_rule").trim());
    gross_weight = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/gross_weight").trim());
    net_weight = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/net_weight").trim());

    weight_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/weight_uom").trim());
    weight_uom = uomdb.convertUom(inter.getUOMConversion(), weight_uom);

    old_material = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/old_material").trim());
    inspection_id = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/inspection_id").trim());
    default_batch_status = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/default_batch_status").trim());

    /* Material Customer Data */
   
    repeat = true;
    seq = 1;
   
    do
    {
      key = "//message/messageData/materialDefinition/materialCustomerData/customer[" + String.valueOf(seq) + "]/@ID";
      customerID = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

      if (customerID.length() > 0)
      {
       
        repeat2 = true;
        seq2 = 1;
        do
        {
          key = "//message/messageData/materialDefinition/materialCustomerData/customer[" + String.valueOf(seq) + "]/data[" + String.valueOf(seq2) + "]/@dataType";
          dataID = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
          key = "//message/messageData/materialDefinition/materialCustomerData/customer[" + String.valueOf(seq) + "]/data[" + String.valueOf(seq2) + "]/@value";
          dataValue = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

          if (dataID.length() > 0)
          {
            if (matcustdata.isValidMaterialCustomerData(material, customerID, dataID)==false)
            {
              matcustdata.create(material, customerID, dataID);
            }
            matcustdata.setData(dataValue);
            matcustdata.update();
           
            if (dataID.equals("NAME"))
            {
              customer_name=dataValue;
            }
           
          } else
          {
            repeat2=false;
          }
         
          seq2++;
         
        } while (repeat2);
       
        if (cust.isValidCustomer(customerID)==false)
        {
          cust.clear();
          cust.create(customerID, customer_name, "Y");
            cust.update();
        }
      }
      else
      {
        repeat=false;
      }

      seq++;

    } while (repeat);

    /* Material Locations */
   
    repeat = true;
    seq = 1;

    do
    {
      key = "//message/messageData/materialDefinition/validLocations/location[" + String.valueOf(seq) + "]/id";
      location = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
      key = "//message/messageData/materialDefinition/validLocations/location[" + String.valueOf(seq) + "]/status";
      status = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

      if (location.length() > 0)
      {
        if (locn.isValidLocation(location) == true)
        {
          if (matlocn.isValidMaterialLocation(material, location) == false)
          {
            matlocn.create(material, location);
          }
          matlocn.setStatus(status);
          matlocn.update();
        }

      } else
      {
        repeat = false;
      }
      seq++;

    } while (repeat);

    /* Material Units of Measure */
   
    repeat = true;
    seq = 1;
    String matUOMError = "";

    do
    {
      key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/uom";
      uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
      uom = uomdb.convertUom(inter.getUOMConversion(), uom);

      if (uom.length() > 0)
      {

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/numerator";
        numerator = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/denominator";
        denominator = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/ean";
        ean = gmh.getXMLDocument().findXPath(key).trim();

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/variant";
        variant = gmh.getXMLDocument().findXPath(key).trim();

        if (uomdb.isValidInternalUom(uom) == false)
        {
          uomdb.create(uom, uom, uom, "Auto created UOM");
        }

        if (matuom.getMaterialUomProperties(material, uom) == false)
        {
          matuom.setMaterial(material);
          matuom.setUom(uom);
          if (matuom.create() == false)
          {
            result = false;
            matUOMError = "Material " + material + " UOM [" + uom + "] create error. " + matuom.getErrorMessage();
            setErrorMessage(matUOMError);
          } else
          {
            setErrorMessage("Material " + material + " created.");
          }
        }

        try
        {
          matuom.setNumerator(Integer.valueOf(JUtility.getDefaultValue(numerator, String.valueOf(matuom.getNumerator()), "0")));
          matuom.setDenominator(Integer.valueOf(JUtility.getDefaultValue(denominator, String.valueOf(matuom.getDenominator()), "0")));

          matuom.setEan(ean);
          matuom.setVariant(variant);

          if (matuom.getNumerator() == 0)
          {
            result = false;
            setErrorMessage("Material " + material + " UOM [" + uom + "]. Numerator cannot be zero.");
          } else
          {
            if (matuom.getDenominator() == 0)
            {
              result = false;
              setErrorMessage("Material " + material + " UOM [" + uom + "]. Denominator cannot be zero.");
            } else
            {
              if (matuom.update() == false)
              {
                result = false;
                setErrorMessage("Material " + material + " UOM [" + uom + "] update error. " + matuom.getErrorMessage());
              }
            }
          }

        } catch (Exception ex)
        {
          result = false;
          setErrorMessage("Material " + material + " UOM [" + uom + "]. Invalid Quantity");
        }

      } else
      {
        repeat = false;
      }
      seq++;
      if (matUOMError.equals("") == false)
      {
        setErrorMessage(matUOMError);
      }

    } while (repeat);

    if (mat.getMaterialProperties(material) == false)
    {
      mat.setBaseUom(JUtility.getDefaultValue(base_uom, mat.getBaseUom(), ""));
      if (mat.create() == false)
      {
        result = false;
        setErrorMessage("Material " + material + " create error. " + mat.getErrorMessage());
      } else
      {
        setErrorMessage("Material " + material + " created.");
      }
    }

    if (uomdb.isValidInternalUom(uom) == false)
    {
      uomdb.create(weight_uom, weight_uom, weight_uom, "Auto created UOM");
    }

    mat.setMaterialType(JUtility.getDefaultValue(materialType, mat.getMaterialType(), ""));
    mat.setDescription(JUtility.getDefaultValue(description, mat.getDescription(), "No description"));
    mat.setBaseUom(JUtility.getDefaultValue(base_uom, mat.getBaseUom(), ""));
View Full Code Here

    super();
    setIconifiable(true);

    lang = new JDBLanguage(Common.selectedHostID, Common.sessionID);

    uomList.add(new JDBUom(Common.selectedHostID, Common.sessionID));
    uomList.addAll(uom.getInternalUoms());
    typeList.add(new JDBMaterialType(Common.selectedHostID, Common.sessionID));
    typeList.addAll(materialType.getMaterialTypes());

    initGUI();
View Full Code Here

  public JInternalFrameProcessOrderAdmin()
  {
    super();
    getContentPane().setLayout(null);

    uomList.add(new JDBUom(Common.selectedHostID, Common.sessionID));
    uomList.addAll(u.getInternalUoms());

    initGUI();

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
View Full Code Here

    super();
   
    moduleList.add(null);
    moduleList.addAll(mod.getModuleIdsByType("USER"));
   
    uomList.add(new JDBUom("", ""));
    uomList.addAll(uom.getInternalUoms());
    typeList.add(new JDBMaterialType(Common.selectedHostID, Common.sessionID));
    typeList.addAll(materialtype.getMaterialTypes());
    JShelfLifeUom slu = new JShelfLifeUom();
    slu.setUom("");
View Full Code Here

  }

  public JInternalFramePalletProperties() {
    super();
    uomList.add(new JDBUom("", ""));
    uomList.addAll(uom.getInternalUoms());

    initGUI();
    final JHelp help = new JHelp();
    help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_ADMIN_MATERIAL_EDIT"));
View Full Code Here

  public JInternalFrameProcessOrderAdmin()
  {
    super();
    getContentPane().setLayout(null);

    uomList.add(new JDBUom(Common.selectedHostID, Common.sessionID));
    uomList.addAll(u.getInternalUoms());

    initGUI();

    JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
View Full Code Here

    JDBMaterial mat = new JDBMaterial(getHostID(), getSessionID());
    JDBMaterialType mattype = new JDBMaterialType(getHostID(), getSessionID());
    JDBMaterialLocation matlocn = new JDBMaterialLocation(getHostID(), getSessionID());
    JDBLocation locn = new JDBLocation(getHostID(), getSessionID());
    JDBMaterialUom matuom = new JDBMaterialUom(getHostID(), getSessionID());
    JDBUom uomdb = new JDBUom(getHostID(), getSessionID());
    JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
    JDBControl ctrl = new JDBControl(getHostID(), getSessionID());

    String defaultBatchStatus = ctrl.getKeyValue("DEFAULT BATCH STATUS");

    inter.getInterfaceProperties("Material Definition", "Input");

    material = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/material").trim());
    setErrorMessage("Material " + material + " updated.");
    materialType = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/materialType").trim());
   
    if (mattype.isValidMaterialType(materialType)==false)
    {
      mattype.create(materialType, materialType);
    }
   
    description = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/description").trim());
    base_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/base_uom").trim());
    base_uom = uomdb.convertUom(inter.getUOMConversion(), base_uom);

    production_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/production_uom").trim());
    production_uom = uomdb.convertUom(inter.getUOMConversion(), production_uom);

    issue_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/issue_uom").trim());
    issue_uom = uomdb.convertUom(inter.getUOMConversion(), issue_uom);

    shelf_life_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life_uom").trim());
    equipment_type = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/equipment_Type").trim());
    shelf_life = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life").trim());
    shelf_life_rule = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/shelf_life_rule").trim());
    gross_weight = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/gross_weight").trim());
    net_weight = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/net_weight").trim());

    weight_uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/weight_uom").trim());
    weight_uom = uomdb.convertUom(inter.getUOMConversion(), weight_uom);

    old_material = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/old_material").trim());
    inspection_id = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/inspection_id").trim());
    default_batch_status = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/materialDefinition/default_batch_status").trim());
   
   
    repeat = true;
    seq = 1;

    do
    {
      key = "//message/messageData/materialDefinition/validLocations/location[" + String.valueOf(seq) + "]/id";
      location = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
      key = "//message/messageData/materialDefinition/validLocations/location[" + String.valueOf(seq) + "]/status";
      status = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
     
      if (location.length() > 0)
      {
        if (locn.isValidLocation(location)==true)
        {
          if (matlocn.isValidMaterialLocation(material,location)==false)
          {
            matlocn.create(material, location);
          }
          matlocn.setStatus(status);
          matlocn.update();
        }
     
      } else
      {
        repeat = false;
      }
      seq++;
     
    } while (repeat);

    repeat = true;
    seq = 1;
    String matUOMError = "";
   
    do
    {
      key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/uom";
      uom = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());
      uom = uomdb.convertUom(inter.getUOMConversion(), uom);

      if (uom.length() > 0)
      {

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/numerator";
        numerator = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/denominator";
        denominator = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath(key).trim());

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/ean";
        ean = gmh.getXMLDocument().findXPath(key).trim();

        key = "//message/messageData/materialDefinition/materialUOMDefinition[" + String.valueOf(seq) + "]/variant";
        variant = gmh.getXMLDocument().findXPath(key).trim();

        if (uomdb.isValidInternalUom(uom)==false)
        {
          uomdb.create(uom, uom, uom, "Auto created UOM");
        }
       
        if (matuom.getMaterialUomProperties(material, uom) == false)
        {
          matuom.setMaterial(material);
          matuom.setUom(uom);
          if (matuom.create() == false)
          {
            result = false;
            matUOMError = "Material " + material + " UOM [" + uom + "] create error. " + matuom.getErrorMessage();
            setErrorMessage(matUOMError);
          } else
          {
            setErrorMessage("Material " + material + " created.");
          }
        }

        try
        {
          matuom.setNumerator(Integer.valueOf(JUtility.getDefaultValue(numerator, String.valueOf(matuom.getNumerator()), "0")));
          matuom.setDenominator(Integer.valueOf(JUtility.getDefaultValue(denominator, String.valueOf(matuom.getDenominator()), "0")));

          matuom.setEan(ean);
          matuom.setVariant(variant);

          if (matuom.getNumerator() == 0)
          {
            result = false;
            setErrorMessage("Material " + material + " UOM [" + uom + "]. Numerator cannot be zero.");
          } else
          {
            if (matuom.getDenominator() == 0)
            {
              result = false;
              setErrorMessage("Material " + material + " UOM [" + uom + "]. Denominator cannot be zero.");
            } else
            {
              if (matuom.update() == false)
              {
                result = false;
                setErrorMessage("Material " + material + " UOM [" + uom + "] update error. " + matuom.getErrorMessage());
              }
            }
          }

        } catch (Exception ex)
        {
          result = false;
          setErrorMessage("Material " + material + " UOM [" + uom + "]. Invalid Quantity");
        }

      } else
      {
        repeat = false;
      }
      seq++;
      if (matUOMError.equals("")==false)
      {
        setErrorMessage(matUOMError);
      }

    } while (repeat);

    if (mat.getMaterialProperties(material) == false)
    {
      mat.setBaseUom(JUtility.getDefaultValue(base_uom, mat.getBaseUom(), ""));
      if (mat.create() == false)
      {
        result = false;
        setErrorMessage("Material " + material + " create error. " + mat.getErrorMessage());
      } else
      {
        setErrorMessage("Material " + material + " created.");
      }
    }
   
    if (uomdb.isValidInternalUom(uom)==false)
    {
      uomdb.create(weight_uom, weight_uom, weight_uom, "Auto created UOM");
    }

    mat.setMaterialType(JUtility.getDefaultValue(materialType, mat.getMaterialType(), ""));
    mat.setDescription(JUtility.getDefaultValue(description, mat.getDescription(), "No description"));
    mat.setBaseUom(JUtility.getDefaultValue(base_uom, mat.getBaseUom(), ""));
View Full Code Here

  public JInternalFramePalletAdmin()
  {
    super();
    getContentPane().setBackground(Color.WHITE);

    uomList.add(new JDBUom(Common.selectedHostID, Common.sessionID));
    uomList.addAll(u.getInternalUoms());

    decisionList.add(new JDBMHNDecisions(Common.selectedHostID, Common.sessionID));
    decisionList.addAll(d.getDecisions());
View Full Code Here

    String path = "";

    JDBInterfaceLog il = new JDBInterfaceLog(getHostID(), getSessionID());
    GenericMessageHeader gmh = new GenericMessageHeader();
    JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
    JDBUom uoml = new JDBUom(getHostID(), getSessionID());
    inter.getInterfaceProperties("Despatch Pre Advice", "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("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 Pre Advice");
          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("despatchPreAdvice");

          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 locationFromGLN = addElement(document, "fromGLN", desp.getLocationDBFrom().getGLN());
          despatchConfirmation.appendChild(locationFromGLN);

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

          Element locationToGLN = addElement(document, "toGLN", desp.getLocationDBTo().getGLN());
          despatchConfirmation.appendChild(locationToGLN);

          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 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());
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBUom

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.