Beispiel #1
0
 public void extractShipByN1(Loop inLoop) throws OBOEException {
   Loop loop = null;
   int numberInVector = inLoop.getCount("N1");
   for (int i = 0; i < numberInVector; i++) {
     loop = inLoop.getLoop("N1", i);
     if (loop == null) return;
     Segment segment = loop.getSegment("N1");
     String qualif = getField(segment, 1, false, null);
     if ("ST".equals(qualif)) {
       String shipToName = getField(segment, 2, false, null);
       ediInp856Vw.setShipToName(shipToName);
       String identQualifier = getField(segment, 3, false, null);
       if ("01".equals(identQualifier)) {
         String shipToCode = getField(segment, 4, false, null);
         ediInp856Vw.setShipToCode(shipToCode);
       }
       extractShipFromN4(loop);
     } else {
       String distName = qualif;
       ediInp856Vw.setDistName(distName);
       String distCodeQualifier = getField(segment, 2, false, null);
       ediInp856Vw.setDistIdentCodeQualif(distCodeQualifier);
       if (!Utility.isSet(distName) && !Utility.isSet(distCodeQualifier)) {
         errorMsgs.add("No distributor info in segment N1");
         setValid(false);
         return;
       }
       if (Utility.isSet(distCodeQualifier)) {
         String distCode = getField(segment, 3, false, null);
         ediInp856Vw.setDistIdentCode(distCode);
         if (!Utility.isSet(distCode) && !Utility.isSet(distName)) {
           errorMsgs.add("No distributor info in segment N1");
           setValid(false);
           return;
         }
       }
     }
   }
 }