我遇到了与fedex的Saturday_PickUp相关的问题,并且我使用了fedex的网络参考来计算费率和货运。实际上,即使我没有在星期六初始化特殊选择的值,它也会显示Saturday_pickup_surcharge。由于在Saturday_delivery工作正常,因此在周六提货也应该有效。正如我已经检查的那样,没有这样的IsSpecified布尔变量可以启用或禁用星期六提取。默认情况下,它采用星期六接送特别服务,并且费率根据特殊服务(即Saturday_pickUp)而提高。
如果您知道如何禁用Saturday_pick_up,请帮助我。由于我已经提供了星期六取件的复选框。
`private static void SetShipmentDetails(RateRequest请求) { request.RequestedShipment = new RequestedShipment();
#region |Setting Ship Date - Make sure to Saturday Delivery and Saturday Pickup : For saturday delivery uncomment code in SetPackageLineItems|
DateTime oDate = DateTime.ParseExact("2018-07-21T18:08:08", "yyyy-MM-ddTHH:mm:ss", null);
request.RequestedShipment.ShipTimestamp = oDate;
request.RequestedShipment.ShipTimestampSpecified = true;
#endregion
request.RequestedShipment.DropoffType = DropoffType.REGULAR_PICKUP; //Drop off types are BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP
// If ServiceType is omitted, all applicable ServiceTypes are returned.
request.RequestedShipment.ServiceType = ServiceType.PRIORITY_OVERNIGHT; // Service types are STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND ...
request.RequestedShipment.ServiceTypeSpecified = true;
request.RequestedShipment.PackagingType = PackagingType.YOUR_PACKAGING;//Packaging type FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
request.RequestedShipment.PackagingTypeSpecified = true;
request.RequestedShipment.PackageCount = "1"; // change in rate according to package count
SetSender(request);
SetRecipient(request);
SetPayment(request);
SetPackageLineItems(request,isCodShipment);
} `
设置发送者,接收者和付款值后 这是装运的值。
`public static void SetPackageLineItems(RateRequest request,bool isCodShipment) { request.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem [1]; request.RequestedShipment.RequestedPackageLineItems [0] = new RequestedPackageLineItem();
request.RequestedShipment.RequestedPackageLineItems[0].SequenceNumber = "1";
request.RequestedShipment.RequestedPackageLineItems[0].GroupPackageCount = "1";
// Package weight information
request.RequestedShipment.RequestedPackageLineItems[0].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Value = 20.0M;
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Units = WeightUnits.LB;
request.RequestedShipment.RequestedPackageLineItems[0].Weight.UnitsSpecified = true;
request.RequestedShipment.RequestedPackageLineItems[0].Weight.ValueSpecified = true;
request.RequestedShipment.RequestedPackageLineItems[0].PhysicalPackaging = PhysicalPackagingType.TUBE;//BOX;
request.RequestedShipment.RequestedPackageLineItems[0].PhysicalPackagingSpecified = true;
//// for saturday delivery
//request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
//request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1];
//request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.SATURDAY_DELIVERY;
if (isCodShipment)
{
SetCOD(request);
}
}`
该代码已注释为星期六交货,因为我没有使用星期五的日期
如果我要使用星期五,那么我们需要取消隐藏该代码。
// for saturday pickup
//request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
//request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1];
//request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.SATURDAY_PICKUP;
星期六取货应该采用相同的方式,因为我不是为星期六写代码,因为它已隐藏,因此不应包括星期六取车费