在使用FedEx费率网络服务参考来计算费率时,请帮我排除星期六的取车附加费。
如果所选的运送日是星期六,则FedEx Rate Web服务始终包含星期六取件附加费。如何禁用它,使其不包括星期六附加费。
当我在IsSaturdayPickUp
下面的代码将向您展示如何根据应用程序放置所需的值并帮助我该怎么做?
private static void SetShipmentDetails(RateRequest request)
{
request.RequestedShipment = new RequestedShipment();
request.RequestedShipment.ShipTimestamp = DateTime.ParseExact(ShipDate, "yyyy-MM-ddTHH:mm:ss", null);
request.RequestedShipment.ShipTimestampSpecified = true;
request.RequestedShipment.DropoffType = DropoffType.REGULAR_PICKUP;
// If ServiceType will be omitted, all applicable ServiceTypes will returned.
if (serviceType != "All")
{
request.RequestedShipment.ServiceType =(ServiceType)Enum.Parse(typeof(ServiceType), serviceType);
request.RequestedShipment.ServiceTypeSpecified = true;
}
request.RequestedShipment.PackagingType = (PackagingType)Enum.Parse(typeof(PackagingType), PackageTypeChoice);
request.RequestedShipment.PackagingTypeSpecified = true;
request.RequestedShipment.PackageCount = PackageCount;
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 = PackageCount;
// Package weight information
request.RequestedShipment.RequestedPackageLineItems[0].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Value = TotalWeight;
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.BOX;
request.RequestedShipment.RequestedPackageLineItems[0].PhysicalPackagingSpecified = true;
if(IsSaturdayDelivery)
{
setSaturdayDeliveryRequest(request);
}
if (IsSaturdayPickup)
{
setSaturdayPickUpRequest(request);
}
if (isCodShipment)
{
SetCOD(request);
}
}
// saturday Pick up
private static void setSaturdayPickUpRequest(RateRequest request)
{
request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1];
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.SATURDAY_PICKUP;
}
// saturday delivery
private static void setSaturdayDeliveryRequest(RateRequest request)
{
request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1];
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.SATURDAY_DELIVERY;
}