Beispiel #1
0
  public void extractItemShipmentDetailSN1(Loop inLoop) throws OBOEException {
    Segment segment = null;
    // valid = false;
    try {
      segment = inLoop.getSegment("SN1");
    } catch (Exception exc) {
    }
    if (segment == null) {
      errorMsgs.add("Segment SN1 missing");
      setValid(false);
      return;
    }
    String shippedQtyS = getField(segment, 2, true, "Missing Number of Units Shipped");
    if (shippedQtyS == null) {
      errorMsgs.add("Number of Units Shipped is null");
      setValid(false);
      return;
    }

    int shippedQty = 0;
    try {
      shippedQty = Integer.parseInt(shippedQtyS);
    } catch (Exception exc) {
      errorMsgs.add("Invalid value of item shipped number: " + shippedQtyS);
      setValid(false);
      return;
    }
    ediInp856ItemVw.setShippedQty(shippedQty);

    String uom = getField(segment, 3, true, "Missing Unit (Basis) for Measurement Code");
    if (uom == null) {
      errorMsgs.add("UOM is null");
      setValid(false);
      return;
    }
    ediInp856ItemVw.setUom(uom);
    return;
  }
Beispiel #2
0
  public void extractItemIdentificationREF(Loop inLoop) throws OBOEException {
    try {
      int numberOfSegmentsInVector = inLoop.getCount("REF");

      Segment segment = null;

      ArrayList trackingNums = new ArrayList();
      for (int i = 0; i < numberOfSegmentsInVector; i++) {
        segment = inLoop.getSegment("REF", i);
        if (segment == null) return;
        String identQualifier = getField(segment, 1, false, null);
        String identification = getField(segment, 2, false, null);
        if ("2I".equals(identQualifier) || "CN".equals(identQualifier)) {
          trackingNums.add(identification);
        }
      }
      ediInp856ItemVw.setTrackingNumList(trackingNums);
    } catch (Exception e) {
      return;
    }

    return;
  }
Beispiel #3
0
  public void extractItemIdentificationLIN(Loop inLoop) throws OBOEException {
    Segment segment = null;
    boolean ignoreMissingLineInfo =
        Utility.isTrue(
            getTranslator()
                .getConfigurationProperty(
                    RefCodeNames.ENTITY_PROPERTY_TYPE.IGNORE_MISSING_LINE_INFO));
    // valid = false;
    try {
      segment = inLoop.getSegment("LIN");
    } catch (Exception exc) {
      exc.printStackTrace();
    }
    if (segment == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Segment LIN missing");
      setValid(false);
      return;
    }
    String orderLineNumS = getField(segment, 1, true, "Missing order line number in LIN segment");
    if (orderLineNumS == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Order Line Number in LIN segment is null");
      setValid(false);
      return;
    }

    int orderLineNum = 0;
    try {
      orderLineNum = Integer.parseInt(orderLineNumS);
    } catch (Exception exc) {
      // JD China will use line num 3.1 for line 3 if order is split for shipment.
      int ix = orderLineNumS.indexOf('.');
      if (ix > 0) {
        String orderLineNumSs = orderLineNumS.substring(0, ix);
        try {
          orderLineNum = Integer.parseInt(orderLineNumSs);
        } catch (Exception ex) {
        }
      }

      if (orderLineNum == 0 && !ignoreMissingLineInfo) {
        errorMsgs.add("Invalid value of order line number in LIN segment: " + orderLineNumS);
        setValid(false);
        return;
      }
    }

    ediInp856ItemVw.setPurchOrderLineNum(orderLineNum);
    for (int fieldNum = 1; fieldNum <= 7; fieldNum += 2) {
      try {
        String productNumQualifier = getField(segment, 1 + fieldNum, false, "");
        if (productNumQualifier == null) {
          // errorMsgs.add("Product Service Id Qualifier is null");
          // setValid(false);
          // return;
          break;
        }
        String productNum = getField(segment, 1 + fieldNum + 1, false, "");
        if ("VP".equals(productNumQualifier) || "VN".equals(productNumQualifier)) {
          ediInp856ItemVw.setDistSkuNum(productNum);
        }
      } catch (Exception exc) {
        break;
      }
    }
    return;
  }
Beispiel #4
0
  /** Extract all segments included in ST - SE Segment */
  public void extract() throws OBOEException {
    ediInp856Vw = EdiInp856View.createValue();
    ediInp856Vw.setItems(new EdiInp856ItemViewVector());

    Table table = ts.getHeaderTable();

    if (table != null) {
      extractHeaderBSN(table);
    }
    table = ts.getDetailTable();
    if (table != null) {
      int HLLoopSize = table.getLoopCount("HL");
      for (int i = 0; i < HLLoopSize; i++) {
        Loop loop = table.getLoop("HL", i);
        Segment segment = loop.getSegment("HL");
        String levelCode =
            getField(segment, 3, true, "Missing Hierarchical Level Code in segment HL*" + i);
        if (levelCode == null) {
          errorMsgs.add("Level Code is null");
          setValid(false);
          continue;
        }
        if (i == 0) {
          if (!"S".equals(levelCode)) {
            errorMsgs.add("Invalid Hierarchical Level Code in segment HL*0 : " + levelCode);
            setValid(false);
            continue;
          }
          extractShipmentLevelREF(loop);
          extractShipmentDTM(loop);
          extractShipmentTD5(loop);
          extractShipByN1(loop);
        } else if (i == 1) {
          if (!"O".equals(levelCode)) {
            errorMsgs.add("Invalid Hierarchical Level Code in segment HL*1 : " + levelCode);
            setValid(false);
            continue;
          }
          extractPurchaseOrderReferencePRF(loop);
          extractReferenceIdentificationREF(loop);
        } else {
          if ("O".equals(levelCode)) {
            extractPurchaseOrderReferencePRF(loop);
            extractReferenceIdentificationREF(loop);
          } else if (!"I".equals(levelCode)) {
            errorMsgs.add(
                "Invalid value of Hierarchical Level Code in segment HL *" + i + " : " + levelCode);
            setValid(false);
            continue;
          } else {
            ediInp856ItemVw = EdiInp856ItemView.createValue();
            ediInp856Vw.getItems().add(ediInp856ItemVw);
            extractItemIdentificationLIN(loop);
            extractItemShipmentDetailSN1(loop);
            extractItemIdentificationREF(loop);
          }
        }
      }
    }
    table = ts.getSummaryTable();
    if (table != null) {
      // extractHeaderTDS(table);
      // extractHeaderSAC(table);
    }
  }