Esempio n. 1
0
 public void extractReferenceIdentificationREF(Loop inLoop) throws OBOEException {
   int qty;
   try {
     qty = inLoop.getSegmentCount("REF");
   } catch (Exception e) {
     return;
   }
   Segment segment = null;
   // valid = true;
   for (int ii = 0; ii < qty; ii++) {
     try {
       segment = inLoop.getSegment("REF", ii);
     } catch (Exception exc) {
     }
     if (segment == null) {
       return;
     }
     String identQualifier = getField(segment, 1, false, null);
     String identification = getField(segment, 2, false, null);
     if ("1V".equals(identQualifier)) {
       ediInp856Vw.setPurchOrderNum(identification);
     } else if ("2I".equals(identQualifier) || "CN".equals(identQualifier)) {
       ediInp856Vw.setTrackingNum(identification);
     } else if ("D2".equals(identQualifier)) {
       ediInp856Vw.setDistOrderNum(identification);
     } else if ("ZZ".equals(identQualifier)) {
       ediInp856Vw.setPurchOrderNum(identification);
     }
   }
   return;
 }
Esempio n. 2
0
  public void extractShipmentDTM(Loop inLoop) throws OBOEException {
    Segment segment = null;
    // valid = false;
    int qty = inLoop.getSegmentCount("DTM");
    for (int ii = 0; ii < qty; ii++) {
      try {
        segment = inLoop.getSegment("DTM", ii);
      } catch (Exception exc) {
      }
      if (segment == null) {
        errorMsgs.add("Segments DTM missing," + ii);
        setValid(false);
        return;
      }
      String dateTimeQualifier =
          getField(segment, 1, true, "Missing Date/Time Qualifier in segment DTM");
      if (dateTimeQualifier == null) {
        errorMsgs.add("Date/Time Qualifier is null");
        setValid(false);
        return;
      }
      if (!"011".equals(dateTimeQualifier)) {
        errorMsgs.add("Invalid value of Date/Time Qualifier in segment DTM: " + dateTimeQualifier);
        setValid(false);
        return;
      }

      String shipmentDateS = getField(segment, 2, true, "Missing Shipment Date in segment DTM");
      if (shipmentDateS == null) {
        errorMsgs.add("Shipment Date is null");
        setValid(false);
        return;
      }
      if (shipmentDateS.length() != 8) {
        errorMsgs.add("Invalid value of Shipment Date: " + shipmentDateS);
        setValid(false);
        return;
      }
      SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
      Date shipmentDate = null;
      try {
        shipmentDate = sdf.parse(shipmentDateS);
      } catch (Exception exc) {
        errorMsgs.add("Invalid value of Shipment Date: " + shipmentDateS);
        setValid(false);
        return;
      }
      if (!shipmentDateS.equals(sdf.format(shipmentDate))) {
        errorMsgs.add("Invalid value of Shipment Date: " + shipmentDateS);
        setValid(false);
        return;
      }
      ediInp856Vw.setShipDate(shipmentDate);
    }
    return;
  }