2

すべての Fedex 追跡情報を自分のデータベースにキャッシュしたいと考えています。私の会社には 1 日あたり約 150 以上の追跡番号があります。このリンクによると...

   http://www.fedex.com/us/developer/product/WebServices/MyWebHelp_August2010/Content/Proprietary_Developer_Guide/tTracking_and_Visibility_Services_condtionalized.htm

Fedex サービスはバッチ処理をサポートしていません..? これは、追跡番号ごとに 1 回電話をかける必要があるということですか? そうやって1日分の売り上げに80秒くらいかかった…

現在、より良いオプションはありませんか?または、これを行うためのより良い方法またはプロセスはありますか?

4

2 に答える 2

0

このコードを使用してください

TrackRequest request = CreateFedexMultipleTrackRequest(TrackingCode);
 TrackService service = new TrackService();
 TrackReply reply = service.track(request);
 if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING)
 {
   reply.CompletedTrackDetails//now manage All tracking As Your Need
 }
 //go to How to create single request for multiple tracking numbers at a time
 private static TrackRequest CreateFedexMultipleTrackRequest(string TrackingNumber)
    {
        //string[] str = new string[] {TrackingNumber};
        string[] staticIntArray = TrackingNumber.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        //int arraycount = staticIntArray.Count();
        TrackRequest request = new TrackRequest();
        request.WebAuthenticationDetail = new WebAuthenticationDetail();
        request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
        request.WebAuthenticationDetail.UserCredential.Key = Application.FedexKey;
        request.WebAuthenticationDetail.UserCredential.Password = Application.FedexPassword;
        request.WebAuthenticationDetail.ParentCredential = new WebAuthenticationCredential();
        request.WebAuthenticationDetail.ParentCredential.Key = Application.FedexKey;
        request.WebAuthenticationDetail.ParentCredential.Password = Application.FedexPassword;
        request.ClientDetail = new ClientDetail();
        request.ClientDetail.AccountNumber = Application.FedexAccountNumber;
        request.ClientDetail.MeterNumber = Application.FedexMeterNumber;
        request.TransactionDetail = new TransactionDetail();
        request.TransactionDetail.CustomerTransactionId = "NA";  //This is a reference field for the customer.  Any value can be used and will be provided in the response.
        request.Version = new VersionId();
        // Tracking information
        request.SelectionDetails = new TrackSelectionDetail[staticIntArray.Length];
        for (int j = 0; j <= staticIntArray.Length - 1; j++) { request.SelectionDetails[j] = new TrackSelectionDetail(); }
        for (int i = 0; i <= staticIntArray.Length - 1; i++)
        {
            request.SelectionDetails[i].PackageIdentifier = new TrackPackageIdentifier();
            request.SelectionDetails[i].PackageIdentifier.Value = staticIntArray[i]; //tracking number or door tag
            request.SelectionDetails[i].PackageIdentifier.Type = TrackIdentifierType.DOCUMENT_AIRWAY_BILL;
            request.SelectionDetails[i].ShipmentAccountNumber = "XXX";
            // Date range is optional.
            // If omitted, set to false
            request.SelectionDetails[i].ShipDateRangeBegin = DateTime.Parse("05/09/2016"); //MM/DD/YYYY
            request.SelectionDetails[i].ShipDateRangeEnd = request.SelectionDetails[0].ShipDateRangeBegin.AddDays(0);
            request.SelectionDetails[i].ShipDateRangeBeginSpecified = true;
            request.SelectionDetails[i].ShipDateRangeEndSpecified = true;
        }
        // Include detailed scans is optional.
        // If omitted, set to false
        request.ProcessingOptions = new TrackRequestProcessingOptionType[1];
        request.ProcessingOptions[0] = TrackRequestProcessingOptionType.INCLUDE_DETAILED_SCANS;
        return request;
    }

//fedex では一度に 30 の番号を追跡できます

于 2017-10-26T10:15:20.217 に答える
-1

はい、各トラックを個別のリクエストとして送信する必要があります。スケジュールを介してサーバー側のプロセスとして実行します。

于 2014-04-25T14:07:50.403 に答える