0

以下回复来自 Sabre TravelItineraryReadRQ

 <ReservationItems>
  <Item>
    <FlightSegment>
      <DestinationLocation>
        <LocationCode>RUH</LocationCode>
        <Terminal>TERMINAL 2</Terminal>
        <TerminalCode>2</TerminalCode>
      </DestinationLocation>
      <Equipment>
        <AirEquipType>320</AirEquipType>
      </Equipment>
      <MarketingAirline>
        <Code>SV</Code>
        <FlightNumber>0573</FlightNumber>
      </MarketingAirline>
      <Meal>
        <Code>M</Code>
      </Meal>
      <OriginLocation>
        <LocationCode>AUH</LocationCode>
        <Terminal>TERMINAL 1</Terminal>
        <TerminalCode>1</TerminalCode>
      </OriginLocation>
      <SupplierRef>
        <ID>123</ID>
      </SupplierRef>
      <UpdatedArrivalTime>06-27T21:50</UpdatedArrivalTime>
      <UpdatedDepartureTime>06-27T21:00</UpdatedDepartureTime>
      <AirMilesFlown>0483</AirMilesFlown>
      <ArrivalDateTime>06-27T21:50</ArrivalDateTime>
      <ConnectionInd>O</ConnectionInd>
      <DayOfWeekInd>6</DayOfWeekInd>
      <DepartureDateTime>2015-06-27T21:00</DepartureDateTime>
      <ElapsedTime>01.50</ElapsedTime>
      <eTicket>false</eTicket>
      <FlightNumber>0573</FlightNumber>
      <NumberInParty>01</NumberInParty>
      <ResBookDesigCode>V</ResBookDesigCode>
      <SegmentNumber>0001</SegmentNumber>
      <SmokingAllowed>false</SmokingAllowed>
      <SpecialMeal>false</SpecialMeal>
      <Status>HK</Status>
      <StopQuantity>00</StopQuantity>
    </FlightSegment>
    <RPH>1</RPH>
  </Item>
  <Item>
    <FlightSegment>
      <DestinationLocation>
        <LocationCode>LHR</LocationCode>
        <Terminal>TERMINAL 4</Terminal>
        <TerminalCode>4</TerminalCode>
      </DestinationLocation>
      <Equipment>
        <AirEquipType>77W</AirEquipType>
      </Equipment>
      <MarketingAirline>
        <Code>SV</Code>
        <FlightNumber>0107</FlightNumber>
      </MarketingAirline>
      <Meal>
        <Code>M</Code>
      </Meal>
      <OriginLocation>
        <LocationCode>RUH</LocationCode>
        <Terminal>TERMINAL 2</Terminal>
        <TerminalCode>2</TerminalCode>
      </OriginLocation>
      <SupplierRef>
        <ID>123</ID>
      </SupplierRef>
      <UpdatedArrivalTime>06-28T07:15</UpdatedArrivalTime>
      <UpdatedDepartureTime>06-28T02:20</UpdatedDepartureTime>
      <AirMilesFlown>3087</AirMilesFlown>
      <ArrivalDateTime>06-28T07:15</ArrivalDateTime>
      <ConnectionInd>I</ConnectionInd>
      <DayOfWeekInd>7</DayOfWeekInd>
      <DepartureDateTime>2015-06-28T02:20</DepartureDateTime>
      <ElapsedTime>06.55</ElapsedTime>
      <eTicket>false</eTicket>
      <FlightNumber>0107</FlightNumber>
      <NumberInParty>01</NumberInParty>
      <ResBookDesigCode>V</ResBookDesigCode>
      <SegmentNumber>0002</SegmentNumber>
      <SmokingAllowed>false</SmokingAllowed>
      <SpecialMeal>false</SpecialMeal>
      <Status>HK</Status>
      <StopQuantity>00</StopQuantity>
    </FlightSegment>
    <RPH>2</RPH>
  </Item>
  <Item>
    <FlightSegment>
      <DestinationLocation>
        <LocationCode>RUH</LocationCode>
        <Terminal>TERMINAL 2</Terminal>
        <TerminalCode>2</TerminalCode>
      </DestinationLocation>
      <Equipment>
        <AirEquipType>77W</AirEquipType>
      </Equipment>
      <MarketingAirline>
        <Code>SV</Code>
        <FlightNumber>0118</FlightNumber>
      </MarketingAirline>
      <Meal>
        <Code>M</Code>
      </Meal>
      <OriginLocation>
        <LocationCode>LHR</LocationCode>
        <Terminal>TERMINAL 4</Terminal>
        <TerminalCode>4</TerminalCode>
      </OriginLocation>
      <SupplierRef>
        <ID>123</ID>
      </SupplierRef>
      <UpdatedArrivalTime>07-16T03:35</UpdatedArrivalTime>
      <UpdatedDepartureTime>07-15T18:50</UpdatedDepartureTime>
      <AirMilesFlown>3087</AirMilesFlown>
      <ArrivalDateTime>07-16T03:35</ArrivalDateTime>
      <ConnectionInd>O</ConnectionInd>
      <DayOfWeekInd>3</DayOfWeekInd>
      <DepartureDateTime>2015-07-15T18:50</DepartureDateTime>
      <ElapsedTime>06.45</ElapsedTime>
      <eTicket>false</eTicket>
      <FlightNumber>0118</FlightNumber>
      <NumberInParty>01</NumberInParty>
      <ResBookDesigCode>V</ResBookDesigCode>
      <SegmentNumber>0003</SegmentNumber>
      <SmokingAllowed>false</SmokingAllowed>
      <SpecialMeal>false</SpecialMeal>
      <Status>HK</Status>
      <StopQuantity>00</StopQuantity>
    </FlightSegment>
    <RPH>3</RPH>
  </Item>
  <Item>
    <FlightSegment>
      <DestinationLocation>
        <LocationCode>AUH</LocationCode>
        <Terminal>TERMINAL 1</Terminal>
        <TerminalCode>1</TerminalCode>
      </DestinationLocation>
      <Equipment>
        <AirEquipType>E70</AirEquipType>
      </Equipment>
      <MarketingAirline>
        <Code>SV</Code>
        <FlightNumber>0578</FlightNumber>
      </MarketingAirline>
      <Meal>
        <Code>M</Code>
      </Meal>
      <OriginLocation>
        <LocationCode>RUH</LocationCode>
        <Terminal>TERMINAL 2</Terminal>
        <TerminalCode>2</TerminalCode>
      </OriginLocation>
      <SupplierRef>
        <ID>123</ID>
      </SupplierRef>
      <UpdatedArrivalTime>07-16T09:15</UpdatedArrivalTime>
      <UpdatedDepartureTime>07-16T06:30</UpdatedDepartureTime>
      <AirMilesFlown>0483</AirMilesFlown>
      <ArrivalDateTime>07-16T09:15</ArrivalDateTime>
      <ConnectionInd>I</ConnectionInd>
      <DayOfWeekInd>4</DayOfWeekInd>
      <DepartureDateTime>2015-07-16T06:30</DepartureDateTime>
      <ElapsedTime>01.45</ElapsedTime>
      <eTicket>false</eTicket>
      <FlightNumber>0578</FlightNumber>
      <NumberInParty>01</NumberInParty>
      <ResBookDesigCode>V</ResBookDesigCode>
      <SegmentNumber>0004</SegmentNumber>
      <SmokingAllowed>false</SmokingAllowed>
      <SpecialMeal>false</SpecialMeal>
      <Status>HK</Status>
      <StopQuantity>00</StopQuantity>
    </FlightSegment>
    <RPH>4</RPH>
  </Item>
</ReservationItems>

从上述回复中,我想确定返回和后续部分。Rph = 1,2 是 Onward,Rph = 3,4 是 Retrun。

当我从 PNR 中读取此信息时,我需要一种方法来识别这些信息。所以我也无法将它与任何其他请求进行比较。

我不是在寻找代码来执行此操作,我是在询问是否有人了解 Sabre,是否有办法使用一些标识符来获取响应以识别 Onward 和 Return,例如MaryGrp

4

2 回答 2

0

我知道这个问题可能很老了,但我看到了,我想我应该回答它,因为它可能会帮助其他人(如果你已经找到解决方法的话),因为没有像MarriageGrp或任何其他的节点排序

这是我要走的流程。

1. When a user searches, save the route information in a table say (Lhr->DXB->Lhr)
2. When the user picks an itinerary from the result and you submit the details to EnhancedAirbook, you get that ReservationItem node which is not grouped (like they were under OriginDestionationOptions in OTA_AILOW
3. The next step is pretty important. 
 a. Extract out all the destionations (in this case it would be DXB,LHR) into a variable say $paxDestLocations; Also we will have a variable say $FlightLegs - that will hold the Legs and the FlightSegments in each legs.

 If there are no more ReservationItems, then you are done. If there are more, then goto C.
 c. Let $totalSegments = count($reservationItems); 
    $usedSegmentsCounter = 0; // Will help know how much of ReservationItems we have used.
    Start a loop like the below..
    // $i will represent each leg of the flight.
    // $pL will equal total destinations
    // $pL = count($paxDestLocations);
    for ($i=0; $i<= $pL-1; $i++){
      $FlightLeg[$i]['FlightSegments'] = [];

      // We wana start counting from usedSegmentsCounter
      $s = $usedSegmentsCounter ;
      for ($j=$s; $j<=$totalSegments-1; $j++){
         // If we just started assigning segments for this leg, then just give the first segment to this leg, we will deal with the other segments in the else block..
         if(empty($FlightLeg[$i]['FlightSegments'])){
           $FlightLeg[$i]['FlightSegments'] = $reservationItems[$j];                                 
         }
         # Pick the segment..and just add it to the current leg
         else{
           $FlightLeg[$i]['FlightSegments'][count($FlightLeg[$i]['FlightSegments'])] = $reservationItems[$j];
         }

         // And below, we check if the current flight segment's destinationCode matched the destionationCode we are currently in..
         if($reservationItem[$j]['FlightSegment']['DestinationLocation']['LocationCode'] == $paxDestLocations[$i]){
             // We are done with the segments in this leg,
             break 2;
         }
      }

    }

    At the end of this loop, you will have an array of this Structure below:

    $FlightLeg = [
          // Leg 1
          [
            ['FlightSegents' = [
             [ // ReservationItem 1],
             [ // ReservationItem 2]
            ]
          ],
          // Leg 2
          [
            ['FlightSegents' = [
             [ // ReservationItem 1],
             [ // ReservationItem 2]
            ]
          ],
    ]

我知道你说你不是在寻找代码 - 但我想使用上面的代码块更容易解释。

于 2016-02-15T10:19:17.290 回答
-1

尝试这个。代码很简单

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq; 

namespace ConsoleApplication2
{
    class Program
    {
        const string FILENAME = @"c:\temp\test.xml";
        static void Main(string[] args)
        {
            XDocument doc = XDocument.Load(FILENAME);
            var results = doc.Descendants("Item")
                .Select(x => new { rph = x.Elements("RPH").FirstOrDefault().Value,
                                   flight = x.Descendants("FlightNumber").FirstOrDefault().Value
                })
                .ToList();

        }
    }
}
​
于 2015-06-23T12:59:30.053 回答