Ejemplo n.º 1
0
 /// <summary>
 /// 匹配出票方
 /// </summary>
 internal void MatchProvider(PolicyMatch.MatchedPolicy policy)
 {
     if (this.IsSpecial)
     {
         if (this.Status == OrderStatus.Ordered || this.Status == OrderStatus.PaidForETDZ)
         {
             if (this.IsThirdRelation)
             {
                 var deduction = Deduction.GetDeduction(policy);
                 var product   = ProductInfo.GetProductInfo(policy);
                 this.Supplier.Rebate = deduction.Purchaser;
                 this.Provider        = getProvider(policy, product);
                 if (policy.PolicyType == PolicyType.BargainDefault || policy.PolicyType == PolicyType.NormalDefault)
                 {
                     this.Provider.Product.IsDefaultPolicy = true;
                 }
                 CustomNo = policy.OriginalPolicy == null ? string.Empty : policy.OriginalPolicy.CustomCode;
                 return;
             }
             throw new CustomException("资源方具有出票资质,不能选择其他出票方出票");
         }
         throw new StatusException(this.Id.ToString());
     }
     throw new CustomException("特殊票才需要匹配出票方出票");
 }
Ejemplo n.º 2
0
        internal static ExternalOrder NewExternalOrder(OrderView orderView, PolicyMatch.MatchedPolicy matchedPolicy, DataTransferObject.Organization.EmployeeDetailInfo employee, AuthenticationChoise choise = AuthenticationChoise.NoNeedAUTH)
        {
            if (!orderView.Flights.Any())
            {
                throw new ArgumentNullException("orderView", "缺少航段信息");
            }
            if (!orderView.Passengers.Any())
            {
                throw new ArgumentNullException("orderView", "缺少乘机人信息");
            }
            if (matchedPolicy == null)
            {
                throw new CustomException("无相关政策信息");
            }

            #region  构造BASE
            var result = new ExternalOrder
            {
                Contact          = orderView.Contact,
                ReservationPNR   = PNRPair.IsNullOrEmpty(orderView.PNR) ? null : orderView.PNR,
                IsReduce         = orderView.IsReduce,
                IsTeam           = orderView.IsTeam,
                AssociateOrderId = orderView.AssociateOrderId,
                AssociatePNR     = orderView.AssociatePNR,
                Source           = orderView.Source,
                Choise           = choise,
                CustomNo         = matchedPolicy.OriginalPolicy == null ? string.Empty : matchedPolicy.OriginalPolicy.CustomCode,
                VisibleRole      = OrderRole.Platform | OrderRole.Purchaser,
                ForbidChangPNR   = false,
                NeedAUTH         = matchedPolicy.OriginalPolicy == null ? matchedPolicy.NeedAUTH : matchedPolicy.OriginalPolicy.NeedAUTH
            };
            var deduction      = Deduction.GetDeduction(matchedPolicy);
            var product        = ProductInfo.GetProductInfo(matchedPolicy);
            var specialProduct = product as SpeicalProductInfo;
            if (specialProduct != null && !hasETDZPermission(matchedPolicy.Provider, specialProduct))
            {
                result.Supplier = getSupplierInfo(matchedPolicy, specialProduct);
            }
            else
            {
                result.Provider = getProvider(matchedPolicy, product);
            }
            result.IsCustomerResource = ProductInfo.IsCustomerResource(matchedPolicy);
            result.IsStandby          = ProductInfo.IsStandby(matchedPolicy);
            result.Purchaser          = getPurchaserInfo(employee, deduction);
            var pnrInfo = PNRInfo.GetPNRInfo(orderView, matchedPolicy);
            result.AddPNRInfo(pnrInfo);
            result.TripType = pnrInfo.TripType;
            result.Status   = result.RequireConfirm ? OrderStatus.Applied : OrderStatus.Ordered;
            if (result.Status == OrderStatus.Applied)
            {
                result.VisibleRole |= result.IsThirdRelation ? OrderRole.Supplier : OrderRole.Provider;
            }
            #endregion
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 换出票方
        /// </summary>
        internal void ChangeProvider(MatchedPolicy policy, bool forbidChangePNR)
        {
            checkCanChangeProvider(policy);
            var newProvider = getProvider(policy, ProductInfo.GetProductInfo(policy));

            if (newProvider.PurchaserRelationType == RelationType.Interior)
            {
                throw new CustomException("该政策是采购的上级发布的政策,不允许指向给该出票方,请重新选择");
            }
            this.Provider       = newProvider;
            this.ForbidChangPNR = forbidChangePNR;
            this.IsB3BOrder     = !policy.IsExternal;
            if (this.IsSpecial)
            {
                var deduction = Deduction.GetDeduction(policy);
                this.Supplier.Rebate = deduction.Purchaser;
            }
            this.Status = OrderStatus.PaidForETDZ;
            CustomNo    = policy.OriginalPolicy == null ? string.Empty : policy.OriginalPolicy.CustomCode;
        }