Example #1
0
        public void Test2()
        {
            BootStrapper.Boot();
            string         pnrContent     = @" 1.陈绪炎 2.陈耀胜 3.李祖新 4.逄增奎 5.王勇 6.易小平    HTFT12     7.  CA4487 Y   SU02NOV  CTUJZH HK6   1405 1500          E T2--   8.CTU/T CTU/T 028-85512345/CTU HUA LONG AIR SERVICE CO.,LTD/YANGHONG ABCDEFG     9.TL/1405/02NOV/CTU186  10.SSR FOID CA HK1 NI420583198402223411/P6   11.SSR FOID CA HK1 NI222426198404075215/P4   12.SSR FOID CA HK1 NI420523196512060013/P3   13.SSR FOID CA HK1 NI422723196608154631/P2   14.SSR FOID CA HK1 NI422723196309291919/P1   15.SSR FOID CA HK1 NI422723196611120037/P5   16.SSR FQTV CA HK1 CTUJZH 4487 Y02NOV CA002810349584/P1                        + 17.SSR ADTK 1E BY CTU30OCT14/1250 OR CXL CA ALL SEGS                           - 18.OSI CA CTCM18215523063/P5 19.OSI CA CTCT13518105618    20.RMK CA/NW2W0K 21.CTU186       >PAT:A   01 Y FARE:CNY1310.00 TAX:CNY50.00 YQ:CNY50.00  TOTAL:1410.00  SFC:01    SFN:01       ";
            PnrData        pnrData        = PnrHelper.GetPnrData(pnrContent);
            string         PolicyId       = "13703423";
            PlatformPolicy platformPolicy = PlatformFactory.GetPlatformByCode("517").GetPoliciesByPnrContent(pnrContent, true, pnrData).Find((p) => p.Id == PolicyId);

            return;


            OrderService IOrderService = ObjectFactory.GetInstance <OrderService>();

            AuthManager.SaveUser(new BPiaoBao.SystemSetting.Domain.Services.Auth.CurrentUserInfo()
            {
                Code            = "5105241974",
                OperatorAccount = "梦之旅",
                OperatorName    = "陈良文"
            });


            IOrderService.CreateInterfaceOrder("517", "04787578460867039561");
        }
Example #2
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._Today.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            string            area          = pnrModel._LegList[0].FromCode;
            _TodayAccountInfo accountInfo   = GetInfo(platSystem, area);
            string            _IsLowerPrice = IsLowPrice ? "1" : "0";
            string            CarryCode     = pnrModel._CarryCode;

            DataSet dsPolicy = new DataSet();
            PTMange ptMange  = new PTMange();

            Logger.WriteLog(LogType.DEBUG, "今日获取政策开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            //System.Data.DataSet dsPolicy = m_PTService.PT_JinRiGetPolicy(_todayAccout, _todayAccout2, _IsLowerPrice, pnrContent);
            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //System.Data.DataSet dsPolicy = m_PTService.PT_NewJinRiGetPolicy(_todayAccout, _todayAccout2, _IsLowerPrice, pnrContent, PTPnrData);
            dsPolicy = ptMange._JinRiGetPolicy(accountInfo._todayAccout, accountInfo._todayAccout2, _IsLowerPrice, pnrContent, pnrData);
            Logger.WriteLog(LogType.DEBUG, "今日获取政策结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");

            //转化
            if (dsPolicy != null && dsPolicy.Tables.Count > 0)
            {
                if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                {
                    DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                    if (dr_Price["Status"].ToString() == "T")
                    {
                        decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                        decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                        decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                        decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                        bool IsLow = _IsLowerPrice == "1" ? true : false;

                        string            StartTime = "00:00", EndTime = "00:00";
                        decimal           PolicyPoint = 0m;
                        DataRowCollection drs         = dsPolicy.Tables[0].Rows;
                        foreach (DataRow dr in drs)
                        {
                            PlatformPolicy policy = new PlatformPolicy();
                            StartTime           = "00:00";
                            EndTime             = "00:00";
                            policy.Id           = dr["PolicyId"] != DBNull.Value ? dr["PolicyId"].ToString() : "";
                            policy.PlatformCode = this.Code;
                            policy.AreaCity     = area;
                            if (!string.IsNullOrEmpty(policy.Id))
                            {
                                policy.IsChangePNRCP = false;
                                policy.IsSp          = dr["RateType"].ToString() == "1" ? true : false;
                                policy.PolicyType    = string.Compare(dr["RateType"].ToString().Trim(), "B2P", true) == 0 ? "1" : "2";
                                policy.PolicyType    = policy.PolicyType == "1" ? "BSP" : "B2B";
                                policy.CarryCode     = CarryCode;
                                StartTime            = dr["WorkTimeBegin"].ToString();
                                EndTime         = dr["WorkTimeEnd"].ToString();
                                policy.WorkTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                StartTime = dr["RefundTimeBegin"].ToString();
                                EndTime   = dr["RefundTimeEnd"].ToString();
                                policy.ReturnTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.AnnulTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                decimal.TryParse(dr["Discounts"].ToString(), out PolicyPoint);
                                policy.PolicyPoint = PolicyPoint;
                                policy.ReturnMoney = 0m;;
                                policy.CPOffice    = dr["OfficeNum"].ToString();
                                policy.Remark      = dr["Remark"].ToString();
                                policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                policy.TodayGYCode = dr["RateId"].ToString();
                                policy.IsLow       = IsLow;
                                policy.SeatPrice   = SeatPrice;
                                policy.ABFee       = TaxFare;
                                policy.RQFee       = RQFare;
                                //过滤不符合的政策点数
                                if (PolicyPoint > 0 && PolicyPoint < 100)
                                {
                                    PolicyList.Add(policy);
                                }
                            }
                        }//foreach
                        //取前几条政策
                        if (platSystem != null)
                        {
                            PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                        }
                    }
                    else
                    {
                        //失败信息
                        string Message = dr_Price["Message"].ToString();
                    }
                }
            }
            return(PolicyList);
        }
Example #3
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._BaiTuo.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            PnrAnalysis.Model.LegInfo leg = pnrModel._LegList[0];
            //离起飞时间2小时内屏蔽获取政策接口
            DateTime t = DateTime.Parse(leg.FlyDate1 + " " + leg.FlyStartTime.Insert(2, ":") + ":00");

            t = t.AddHours(-2);
            if (DateTime.Compare(t, System.DateTime.Now) <= 0)
            {
                return(PolicyList);
            }
            string             area        = pnrModel._LegList[0].FromCode;
            _BaiTuoAccountInfo accountInfo = GetInfo(platSystem, area);
            //是否换编码出票 1:是
            string _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string _IsLowerPrice  = IsLowPrice ? "1" : "0";
            string Message        = string.Empty;
            string CarryCode      = pnrModel._CarryCode;

            if (pnrModel._LegList.Count > 0)
            {
                int       Index     = 0;
                DayOfWeek dayOfWeek = System.DateTime.Now.DayOfWeek;
                switch (dayOfWeek)
                {
                case DayOfWeek.Monday:
                    Index = 0;
                    break;

                case DayOfWeek.Tuesday:
                    Index = 1;
                    break;

                case DayOfWeek.Wednesday:
                    Index = 2;
                    break;

                case DayOfWeek.Thursday:
                    Index = 3;
                    break;

                case DayOfWeek.Friday:
                    Index = 4;
                    break;

                case DayOfWeek.Saturday:
                    Index = 5;
                    break;

                case DayOfWeek.Sunday:
                    Index = 6;
                    break;

                default:
                    break;
                }
                DataSet dsPolicy = new DataSet();
                PTMange ptMange  = new PTMange();
                Logger.WriteLog(LogType.DEBUG, "百拓获取政策开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
                //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
                //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
                //System.Data.DataSet dsPolicy = m_PTService.PT_BaiTuoGetPolicy(_baiTuoAccout, _baiTuoPassword, baiTuoAg, _IsLowerPrice, pnrContent);
                //System.Data.DataSet dsPolicy = m_PTService.PT_NewBaiTuoGetPolicy(_baiTuoAccout, _baiTuoPassword, baiTuoAg, _IsLowerPrice, pnrContent, PTPnrData);
                dsPolicy = ptMange._BaiTuoGetPolicy(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, _IsLowerPrice, pnrContent, pnrData);
                Logger.WriteLog(LogType.DEBUG, "百拓获取政策结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
                //转化
                if (dsPolicy != null && dsPolicy.Tables.Count > 0)
                {
                    if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                    {
                        DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                        if (dr_Price["Status"].ToString() == "T")
                        {
                            decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                            decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                            decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                            decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                            bool IsLow = _IsLowerPrice == "1" ? true : false;

                            string            StartTime = "00:00", EndTime = "00:00";
                            decimal           PolicyPoint = 0m;
                            string[]          strTimeArr  = null;
                            DataRowCollection drs         = dsPolicy.Tables[0].Rows;
                            foreach (DataRow dr in drs)
                            {
                                PlatformPolicy policy = new PlatformPolicy();
                                StartTime           = "00:00";
                                EndTime             = "00:00";
                                policy.Id           = dr["Id"] != DBNull.Value ? dr["Id"].ToString() : "";
                                policy.PlatformCode = this.Code;
                                policy.AreaCity     = area;
                                if (!string.IsNullOrEmpty(policy.Id))
                                {
                                    policy.IsChangePNRCP = dr["ChangePnr"].ToString() == "1" ? true : false;
                                    policy.IsSp          = false;
                                    policy.PolicyType    = dr["PolicyType"].ToString() == "2" ? "2" : "1";
                                    policy.PolicyType    = policy.PolicyType == "1" ? "BSP" : "B2B";
                                    policy.CarryCode     = CarryCode;
                                    if (dr["ProviderWorkTime"].ToString().Split(',').Length == 7 && Index > -1 && Index < 7)
                                    {
                                        strTimeArr = dr["ProviderWorkTime"].ToString().Split(',');
                                        if (strTimeArr[Index].Split('-').Length == 2)
                                        {
                                            StartTime = strTimeArr[Index].Split('-')[0];
                                            EndTime   = strTimeArr[Index].Split('-')[1];
                                        }
                                    }
                                    policy.WorkTime = new StartAndEndTime()
                                    {
                                        StartTime = StartTime, EndTime = EndTime
                                    };
                                    if (dr["VoidWorkTime"].ToString().Split(',').Length == 7 && Index > -1 && Index < 7)
                                    {
                                        strTimeArr = dr["VoidWorkTime"].ToString().Split(',');
                                        if (strTimeArr[Index].Split('-').Length == 2)
                                        {
                                            StartTime = strTimeArr[Index].Split('-')[0];
                                            EndTime   = strTimeArr[Index].Split('-')[1];
                                        }
                                    }
                                    policy.ReturnTicketTime = new StartAndEndTime()
                                    {
                                        StartTime = StartTime, EndTime = EndTime
                                    };
                                    policy.AnnulTicketTime = new StartAndEndTime()
                                    {
                                        StartTime = StartTime, EndTime = EndTime
                                    };
                                    policy.ReturnMoney = 0m;
                                    policy.CPOffice    = dr["Office"].ToString();
                                    policy.Remark      = dr["Remark"].ToString();
                                    decimal.TryParse(dr["Rate"].ToString(), out PolicyPoint);
                                    policy.PolicyPoint = PolicyPoint * 100;
                                    policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                    if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                    {
                                        continue;
                                    }

                                    policy.IsLow     = IsLow;
                                    policy.SeatPrice = SeatPrice;
                                    policy.ABFee     = TaxFare;
                                    policy.RQFee     = RQFare;
                                    //过滤不符合的政策点数
                                    if (PolicyPoint > 0 && PolicyPoint < 100)
                                    {
                                        PolicyList.Add(policy);
                                    }
                                }
                            }//foreach
                            //取前几条政策
                            if (platSystem != null)
                            {
                                PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                            }
                        }
                        else
                        {
                            //失败信息
                            Message = dr_Price["Message"].ToString();
                        }
                    }
                    else
                    {
                        if (dsPolicy.Tables.Contains("Error"))
                        {
                            //失败信息
                            Message = dsPolicy.Tables["Error"].Rows[0]["Error_Text"].ToString();
                        }
                    }
                }
            }
            else
            {
                Message = string.Format("PNR内容解析航段失败:{0}", pnrContent);
            }
            if (!string.IsNullOrEmpty(Message))
            {
                throw new PnrAnalysisFailException(Message);
            }
            return(PolicyList);
        }
Example #4
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._517.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || platSystem == null || !platSystem.State)
            {
                return(PolicyList);
            }
            string          area        = pnrModel._LegList[0].FromCode;
            _517AccountInfo accountInfo = GetInfo(platSystem, area);
            //是否换编码出票 1:是
            string  _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string  _IsLowerPrice  = IsLowPrice ? "1" : "0";
            PTMange ptMange        = new PTMange();
            DataSet dsPolicy       = new DataSet();

            Logger.WriteLog(LogType.DEBUG, "517开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            //System.Data.DataSet dsPolicy = m_PTService.PT_517GetPolicy(_517Accout, _517Password, _517Ag, _IsLowerPrice, pnrContent);
            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //dsPolicy= m_PTService.PT_New517GetPolicy(_517Accout, _517Password, _517Ag, _IsLowerPrice, pnrContent, PTPnrData);
            dsPolicy = ptMange._517GetPolicy(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, _IsLowerPrice, pnrContent, pnrData);
            Logger.WriteLog(LogType.DEBUG, "517结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            if (dsPolicy != null && dsPolicy.Tables.Count > 0)
            {
                if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                {
                    DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                    if (dr_Price["Status"].ToString() == "T")
                    {
                        decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                        decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                        decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                        decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                        bool IsLow = _IsLowerPrice == "1" ? true : false;
                        DataRowCollection drs = dsPolicy.Tables[0].Rows;
                        string            StartTime = "00:00", EndTime = "00:00";
                        decimal           PolicyPoint = 0m;
                        foreach (DataRow dr in drs)
                        {
                            PlatformPolicy policy = new PlatformPolicy();
                            policy.AreaCity     = area;
                            StartTime           = "00:00";
                            EndTime             = "00:00";
                            policy.PlatformCode = this.Code;
                            policy.Id           = dr["PolicyID"].ToString() + "~" + dr["PolicyChildID"].ToString();
                            if (policy.Id != "~")
                            {
                                //IsChangePNRCP         //是否换编码出票
                                //IsSp                  //是否是特殊政策
                                //CarryCode             //航空格式二字码
                                //TravelType            //1单程  2单程/往返  3往返 4联程
                                //PolicyType            //政策类型1.BSP 2.B2B
                                //FromCity              //出发城市二字码
                                //ToCity                //到达城市二字码
                                //FlightType            //航班适用类型 0.适用全部 1.适用航班 2.不适用航班
                                //ScheduleConstraints   //班期限制
                                //Space                 //舱位
                                //EffectDate            //政策开始生效期
                                //ExpirationDate         //政策结束生效期
                                //Remark                //政策备注
                                //Policy                //政策点数
                                //GYOnlineTime          //供应工作时间
                                //GYFPTime              //退废票时间
                                //Office                //Office号
                                bool IsChangePNRCP = false;
                                policy.CarryCode = dr["CarryCode"].ToString();
                                bool.TryParse(dr["IsChangePNRCP"].ToString(), out IsChangePNRCP);
                                policy.IsChangePNRCP = IsChangePNRCP;
                                policy.IsSp          = dr["IsSp"].ToString() == "1" ? true : false;
                                policy.PolicyType    = dr["PolicyType"].ToString() == "1" ? "BSP" : "B2B";
                                if (dr["GYOnlineTime"].ToString().Split('-').Length == 2)
                                {
                                    StartTime = dr["GYOnlineTime"].ToString().Split('-')[0];
                                    EndTime   = dr["GYOnlineTime"].ToString().Split('-')[1];
                                }
                                policy.WorkTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };

                                var    now      = DateTime.Now;
                                string GYFPTime = "";
                                if (now.DayOfWeek == DayOfWeek.Sunday || now.DayOfWeek == DayOfWeek.Saturday)
                                {
                                    GYFPTime = dr["GYFPTimeNew"].ToString();
                                }
                                else
                                {
                                    GYFPTime = dr["GYFPTime"].ToString();
                                }
                                if (GYFPTime.Split('-').Length == 2)
                                {
                                    StartTime = GYFPTime.ToString().Split('-')[0];
                                    EndTime   = GYFPTime.ToString().Split('-')[1];
                                }
                                policy.ReturnTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.AnnulTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.ReturnMoney = 0m;
                                policy.CPOffice    = dr["Office"].ToString();
                                policy.Remark      = dr["Remark"].ToString().Contains("改期收回代理费") ? dr["Remark"].ToString() : dr["Remark"].ToString() + ",改期收回代理费";
                                decimal.TryParse(dr["Policy"].ToString(), out PolicyPoint);
                                policy.PolicyPoint = PolicyPoint;
                                if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                {
                                    continue;
                                }
                                string IssueSpeed  = dr["ChupPiaoXiaolu"] == DBNull.Value ? "" : dr["ChupPiaoXiaolu"].ToString();
                                int    _IssueSpeed = 0;
                                if (!string.IsNullOrEmpty(IssueSpeed) && int.TryParse(IssueSpeed, out _IssueSpeed))
                                {
                                    policy.IssueSpeed = _IssueSpeed <= 20 ? "极速" : _IssueSpeed + "秒";
                                }
                                else
                                {
                                    policy.IssueSpeed = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                }
                                policy.IsLow     = IsLow;
                                policy.SeatPrice = SeatPrice;
                                policy.ABFee     = TaxFare;
                                policy.RQFee     = RQFare;
                                //过滤不符合的政策点数
                                if (PolicyPoint > 0 && PolicyPoint < 100)
                                {
                                    PolicyList.Add(policy);
                                }
                            }
                        }//foreach
                        //取前几条政策
                        if (platSystem != null)
                        {
                            PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                        }
                    }
                    else
                    {
                        //失败信息
                        string Message = dr_Price["Message"].ToString();
                    }
                }
            }
            return(PolicyList);
        }
        private void SetInterface(string platformCode, string operatorName, string source, ref decimal TotlePaidPirce, PlatformPolicy policy, UserRelation userRealtion, ref PlatformOrder platformOrder, PnrData pnrData)
        {
            #region 接口政策信息

            order.Policy.AreaCity            = policy.AreaCity;
            order.Policy.PolicyId            = policy.Id;
            order.Policy.PlatformCode        = platformCode;
            order.Policy.OriginalPolicyPoint = policy.PolicyPoint;
            order.Policy.DownPoint           = 0m;
            order.Policy.PaidPoint           = policy.PolicyPoint;
            if (source != "back")
            {
                order.Policy.PolicyPoint = order.Policy.PaidPoint;
            }
            order.Policy.ReturnMoney = policy.ReturnMoney;
            order.Policy.IsLow       = policy.IsLow;
            order.Policy.SeatPrice   = policy.SeatPrice;
            order.Policy.ABFee       = policy.ABFee;
            order.Policy.RQFee       = policy.RQFee;

            order.Policy.Remark           = policy.Remark;
            order.Policy.IsChangePNRCP    = policy.IsChangePNRCP;
            order.Policy.IsSp             = policy.IsSp;
            order.Policy.PolicyType       = policy.PolicyType;
            order.Policy.WorkTime         = policy.WorkTime;
            order.Policy.ReturnTicketTime = policy.ReturnTicketTime;
            order.Policy.AnnulTicketTime  = policy.AnnulTicketTime;
            order.Policy.CPOffice         = policy.CPOffice;
            order.Policy.OrderId          = order.OrderId;
            order.Policy.PolicySourceType = EnumPolicySourceType.Interface;
            order.Policy.CarryCode        = order.SkyWays[0].CarrayCode;
            order.Policy.IssueSpeed       = policy.IssueSpeed;
            order.Policy.TodayGYCode      = policy.TodayGYCode;
            #endregion
        }
        public override object Execute()
        {
            //记录时间
            StringBuilder sbLog = new StringBuilder();
            Stopwatch     watch = new Stopwatch();

            try
            {
                watch.Start();
                string    platformCode = getParame("platformCode").ToString();
                string    policyId     = getParame("policyId").ToString();
                string    operatorName = getParame("operatorName").ToString();
                string    source       = getParame("source").ToString();
                PolicyDto policyUI     = source != "back" ? (getParame("policy") as PolicyDto) : null;

                decimal TotlePaidPirce = 0m;
                OldOutOrderId = order.OutOrderId;
                string          innerPlatformCode = "系统";
                DataBill        databill          = new DataBill();
                DomesticService domesticService   = ObjectFactory.GetInstance <DomesticService>();
                UserRelation    userRealtion      = domesticService.GetUserRealtion(order.BusinessmanCode);
                bool            IspolicyIsNull    = false;

                if (policyUI != null)
                {
                    //赋值
                    order.Policy = PolicyDtoPolicy(policyUI, order.Policy, source);
                }
                else
                {
                    #region 原获取政策
                    PolicyParam policyParam = new PolicyParam();
                    policyParam.code              = order.BusinessmanCode;
                    policyParam.PnrContent        = order.PnrContent;
                    policyParam.OrderId           = order.OrderId;
                    policyParam.OrderType         = order.OrderType;
                    policyParam.OrderSource       = order.OrderSource;
                    policyParam.IsChangePnrTicket = order.IsChangePnrTicket;
                    policyParam.IsDestine         = order.OrderSource == EnumOrderSource.WhiteScreenDestine ? true : false;
                    Passenger pasData = order.Passengers.Where(p => p.PassengerType != EnumPassengerType.Baby).FirstOrDefault();
                    if (pasData != null)
                    {
                        policyParam.defFare   = pasData.SeatPrice.ToString();
                        policyParam.defTAX    = pasData.ABFee.ToString();
                        policyParam.defRQFare = pasData.RQFee.ToString();
                    }
                    if (order.Policy == null)
                    {
                        IspolicyIsNull = true;
                        order.Policy   = new Policy();
                    }
                    Policy         localPolicy   = null;
                    PlatformPolicy policy        = null;
                    PlatformOrder  platformOrder = null;
                    PolicyService  policyService = ObjectFactory.GetInstance <PolicyService>();
                    watch.Stop();
                    sbLog.AppendFormat("初始话变量时间:{0}\r\n", watch.Elapsed.ToString());
                    watch.Restart();

                    if (platformCode != innerPlatformCode)
                    {
                        PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent);
                        policy = PlatformFactory.GetPlatformByCode(platformCode).GetPoliciesByPnrContent(order.PnrContent, order.IsLowPrice, pnrData).Find((p) => p.Id == policyId);
                        watch.Stop();
                        sbLog.AppendFormat("0.调用方法【GetPlatformByCode】用时:{0}\r\n", watch.Elapsed.ToString());
                        watch.Restart();

                        if (policy == null)
                        {
                            localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy);
                            watch.Stop();
                            sbLog.AppendFormat("1.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                            if (localPolicy != null)
                            {
                                order.Policy = localPolicy;
                            }
                            else
                            {
                                throw new OrderCommException("政策发生变动,请重新获取政策!!!");
                            }
                        }
                        else
                        {
                            SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData);
                            watch.Stop();
                            sbLog.AppendFormat("2.调用方法【SetInterface】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                        }
                    }
                    else
                    {
                        localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy);
                        watch.Stop();
                        sbLog.AppendFormat("3.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                        watch.Restart();
                        if (localPolicy == null)
                        {
                            PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent);
                            localPolicy = policyService.GetInterfacePolicy(policyParam, "", userRealtion, pnrData).Find((p) => p.PolicyId == policyId);
                            watch.Stop();
                            sbLog.AppendFormat("4.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                            if (localPolicy != null)
                            {
                                policy.AreaCity    = localPolicy.AreaCity;
                                policy.Id          = localPolicy.PolicyId;
                                policy.PolicyPoint = localPolicy.PolicyPoint;
                                if (source != "back")
                                {
                                    policy.PolicyPoint = localPolicy.PaidPoint;
                                }
                                policy.ReturnMoney      = localPolicy.ReturnMoney;
                                policy.IsLow            = localPolicy.IsLow;
                                policy.SeatPrice        = localPolicy.SeatPrice;
                                policy.ABFee            = localPolicy.ABFee;
                                policy.RQFee            = localPolicy.RQFee;
                                policy.Remark           = localPolicy.Remark;
                                policy.IsChangePNRCP    = localPolicy.IsChangePNRCP;
                                policy.IsSp             = localPolicy.IsSp;
                                policy.PolicyType       = localPolicy.PolicyType;
                                policy.WorkTime         = localPolicy.WorkTime;
                                policy.ReturnTicketTime = localPolicy.ReturnTicketTime;
                                policy.AnnulTicketTime  = localPolicy.AnnulTicketTime;
                                policy.CPOffice         = localPolicy.CPOffice;
                                policy.IssueSpeed       = localPolicy.IssueSpeed;
                                TotlePaidPirce          = platformOrder.TotlePaidPirce;

                                SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData);
                                watch.Stop();
                                sbLog.AppendFormat("5.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                                watch.Restart();
                            }
                            else
                            {
                                if (localPolicy == null)
                                {
                                    throw new OrderCommException("政策发生变动,请重新获取政策!");
                                }
                            }
                        }
                        else
                        {
                            //赋值
                            order.Policy = localPolicy;
                        }
                    }
                    #endregion
                }


                decimal _OrderMoney = 0m;
                if (source != "back")
                {
                    //扣点组类型
                    DeductionType deductionType = order.Policy.PolicySourceType == EnumPolicySourceType.Local ? DeductionType.Local : (order.Policy.PolicySourceType == EnumPolicySourceType.Share ? DeductionType.Share : DeductionType.Interface);
                    if (policyUI != null)
                    {
                        order.Policy.PolicyPoint = order.Policy.PaidPoint;
                    }
                    PlatformDeductionParam pfDp = new PlatformDeductionParam();
                    foreach (SkyWay leg in order.SkyWays)
                    {
                        pfDp.FlyLineList.Add(new FlyLine()
                        {
                            CarrayCode   = leg.CarrayCode,
                            FromCityCode = leg.FromCityCode,
                            ToCityCode   = leg.ToCityCode
                        });
                    }
                    //匹配扣点规则
                    domesticService.MatchDeductionRole(order.Policy, pfDp, order.SkyWays[0].CarrayCode, userRealtion.deductionGroup, userRealtion, deductionType);
                    watch.Stop();
                    sbLog.AppendFormat("6.调用方法【MatchDeductionRole】用时:{0}\r\n", watch.Elapsed.ToString());
                    watch.Restart();

                    //佣金
                    order.Policy.Commission = databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney);
                    //单人支付金额 根据选择的政策 设置价格
                    for (int i = 0; i < order.Passengers.Count; i++)
                    {
                        Passenger p = order.Passengers[i];
                        if (p.PassengerType != EnumPassengerType.Baby)
                        {
                            p.SeatPrice = order.Policy.SeatPrice;
                            p.ABFee     = order.Policy.ABFee;
                            p.RQFee     = order.Policy.RQFee;
                            p.PayMoney  = databill.GetPayPrice(order.Policy.SeatPrice, order.Policy.ABFee, order.Policy.RQFee, order.Policy.PolicyPoint, order.Policy.ReturnMoney);
                        }
                        else
                        {
                            p.PayMoney = databill.GetPayPrice(p.SeatPrice, p.ABFee, p.RQFee, 0, 0);
                        }
                    }
                    _OrderMoney = order.Passengers.Sum(p => p.PayMoney);
                    order.OrderCommissionTotalMoney = order.Passengers.Sum(p => p.PassengerType != EnumPassengerType.Baby ? databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney) : 0);
                }

                #region 支付信息
                if (order.OrderPay == null)
                {
                    order.OrderPay = new OrderPay();
                }

                order.OrderPay.OrderId   = order.OrderId;
                order.OrderPay.PaidMoney = TotlePaidPirce;
                if (source != "back")
                {
                    order.OrderPay.PayMoney  = _OrderMoney;
                    order.OrderMoney         = _OrderMoney;
                    order.OrderPay.PayStatus = EnumPayStatus.NoPay;
                }
                order.OrderPay.PaidStatus    = EnumPaidStatus.NoPaid;
                order.OrderPay.TradePoundage = 0m;
                order.OrderPay.SystemFee     = 0m;
                order.CpOffice = order.Policy.CPOffice;
                #endregion


                #region 根据政策扣点明细计算支付分润
                if (source != "back")
                {
                    domesticService.CreateBillDetails(order, userRealtion);
                    watch.Stop();
                    sbLog.AppendFormat("7.调用方法【CreateBillDetails】用时:{0}\r\n", watch.Elapsed.ToString());
                }
                #endregion
                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("{0}选择政策,政策:{1},编号:{2},订单号:{3},出票速度:{4}", source, order.Policy.PolicyPoint, order.Policy.PolicyId, order.OrderId, order.Policy.IssueSpeed),
                    OperationDatetime = DateTime.Now,
                    OperationPerson   = operatorName,
                    IsShowLog         = false
                });

                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("选择政策,订单号:{0},出票速度:{1}", order.OrderId, order.Policy.IssueSpeed),
                    OperationDatetime = DateTime.Now,
                    OperationPerson   = operatorName,
                    IsShowLog         = true
                });

                if (source == "back")
                {
                    //order.ChangeStatus(EnumOrderStatus.WaitAndPaid);
                    order.ChangeStatus(EnumOrderStatus.PayWaitCreatePlatformOrder);
                }
                else
                {
                    order.ChangeStatus(EnumOrderStatus.NewOrder);
                }
            }
            finally
            {
                if (sbLog.ToString() != "")
                {
                    new CommLog().WriteLog("NewSelectPolicyBehavior", sbLog.ToString());
                }
            }
            if (order.Policy.PolicySourceType == EnumPolicySourceType.Interface)
            {
                order.Policy.Code        = string.Empty;
                order.Policy.Name        = string.Empty;
                order.Policy.CashbagCode = string.Empty;
            }
            return(null);
        }
Example #7
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            string             areaCity    = pnrModel._LegList[0].FromCode;
            _8000YIAccountInfo accountInfo = GetInfo(platSystem, areaCity);
            //是否换编码出票 1:是
            string  _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string  _IsLowerPrice  = IsLowPrice ? "1" : "0";
            DataSet dsPolicy       = new DataSet();
            PTMange ptMange        = new PTMange();

            Logger.WriteLog(LogType.DEBUG, "8000YI开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //System.Data.DataSet dsPolicy = m_PTService.PT_8000YIGetPolicy(_8000yiAccout, _8000yiPassword, _IsLowerPrice, pnrContent);
            //System.Data.DataSet dsPolicy = m_PTService.PT_New8000YIGetPolicy(_8000yiAccout, _8000yiPassword, _IsLowerPrice, pnrContent, PTPnrData);
            dsPolicy = ptMange._8000YIGetPolicy(accountInfo._8000yiAccout, accountInfo._8000yiPassword, _IsLowerPrice, pnrContent, pnrData);
            Logger.WriteLog(LogType.DEBUG, "8000YI结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            if (dsPolicy != null && dsPolicy.Tables.Count > 0)
            {
                if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                {
                    DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                    if (dr_Price["Status"].ToString() == "T")
                    {
                        decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                        decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                        decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                        decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                        bool IsLow = _IsLowerPrice == "1" ? true : false;

                        string            StartTime = "00:00", EndTime = "00:00";
                        decimal           PolicyPoint = 0m;
                        DataRowCollection drs         = dsPolicy.Tables[0].Rows;
                        foreach (DataRow dr in drs)
                        {
                            PlatformPolicy policy = new PlatformPolicy();
                            StartTime           = "00:00";
                            EndTime             = "00:00";
                            policy.Id           = dr["A1"] != DBNull.Value ? dr["A1"].ToString() : "";
                            policy.PlatformCode = this.Code;
                            policy.AreaCity     = areaCity;
                            if (!string.IsNullOrEmpty(policy.Id))
                            {
                                policy.IsChangePNRCP = dr["A17"].ToString().Contains("换编码出票") ? true : false;
                                policy.IsSp          = dr["A22"].ToString() == "1" ? true : false;
                                policy.PolicyType    = string.Compare(dr["A16"].ToString().Trim(), "BSP", true) == 0 ? "1" : "2";
                                policy.PolicyType    = policy.PolicyType == "1" ? "BSP" : "B2B";
                                policy.CarryCode     = dr["A4"].ToString();

                                if (dr["A12"].ToString().Split('|').Length == 2)
                                {
                                    StartTime = dr["A12"].ToString().Split('|')[0];
                                    EndTime   = dr["A12"].ToString().Split('|')[1];
                                }
                                policy.WorkTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                if (dr["A19"].ToString().Split('|').Length == 2)
                                {
                                    StartTime = dr["A19"].ToString().Split('|')[0];
                                    EndTime   = dr["A19"].ToString().Split('|')[1];
                                }
                                policy.ReturnTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                if (dr["A20"].ToString().Split('|').Length == 2)
                                {
                                    StartTime = dr["A20"].ToString().Split('|')[0];
                                    EndTime   = dr["A20"].ToString().Split('|')[1];
                                }
                                policy.AnnulTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.ReturnMoney = 0m;
                                policy.CPOffice    = dr["A26"].ToString();
                                policy.Remark      = dr["A17"].ToString();
                                decimal.TryParse(dr["A8"].ToString(), out PolicyPoint);
                                policy.PolicyPoint = PolicyPoint;
                                policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                {
                                    continue;
                                }
                                //dr["A30"].ToString() == "1" ? true : false;
                                policy.IsLow     = IsLow;
                                policy.SeatPrice = SeatPrice;
                                policy.ABFee     = TaxFare;
                                policy.RQFee     = RQFare;
                                //过滤不符合的政策点数
                                if (PolicyPoint > 0 && PolicyPoint < 100)
                                {
                                    PolicyList.Add(policy);
                                }
                            }
                        }//foreach
                        //取前几条政策
                        if (platSystem != null)
                        {
                            PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                        }
                    }
                    else
                    {
                        //失败信息
                        string Message = dr_Price["Message"].ToString();
                    }
                }
            }
            //转化
            return(PolicyList);
        }
Example #8
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._YeeXing.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            string area = PnrHelper.GetArea(pnrContent);
            _YeeXingAccountInfo accountInfo = GetInfo(platSystem, area);
            //是否换编码出票 1:是
            string _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string _IsLowerPrice  = IsLowPrice ? "1" : "0";

            if (pnrModel._LegList.Count > 0)
            {
                DayOfWeek dayOfWeek = System.DateTime.Now.DayOfWeek; //DateTime.Parse(pnrModel._LegList[0].FlyDate1).DayOfWeek;
                DataSet   dsPolicy  = new DataSet();
                PTMange   ptMange   = new PTMange();

                Logger.WriteLog(LogType.DEBUG, "易行获取政策开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
                //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
                //System.Data.DataSet dsPolicy = m_PTService.PT_YeeXingGetPolicy(_yeeXingAccout, _yeeXingAccout2, _IsLowerPrice, pnrContent);
                //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
                //System.Data.DataSet dsPolicy = m_PTService.PT_NewYeeXingGetPolicy(_yeeXingAccout, _yeeXingAccout2, _IsLowerPrice, pnrContent, PTPnrData);
                dsPolicy = ptMange._YeeXingGetPolicy(accountInfo._yeeXingAccout, accountInfo._yeeXingAccout2, _IsLowerPrice, pnrContent, pnrData);
                Logger.WriteLog(LogType.DEBUG, "易行获取政策结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");

                //转化
                if (dsPolicy != null && dsPolicy.Tables.Count > 0)
                {
                    if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                    {
                        DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                        if (dr_Price["Status"].ToString() == "T")
                        {
                            decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                            decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                            decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                            decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                            bool IsLow = _IsLowerPrice == "1" ? true : false;

                            string            StartTime = "00:00", EndTime = "00:00";
                            decimal           PolicyPoint = 0m, ReturnMoney = 0m;
                            DataRowCollection drs = dsPolicy.Tables[0].Rows;
                            foreach (DataRow dr in drs)
                            {
                                PlatformPolicy policy = new PlatformPolicy();
                                //outTime  出票速度
                                StartTime           = "00:00";
                                EndTime             = "00:00";
                                policy.Id           = dr["plcid"] != DBNull.Value ? dr["plcid"].ToString() : "";
                                policy.PlatformCode = this.Code;
                                policy.AreaCity     = area;
                                if (!string.IsNullOrEmpty(policy.Id))
                                {
                                    policy.IsChangePNRCP = dr["changePnr"].ToString().Trim() == "1" ? true : false;
                                    policy.IsSp          = dr["isSphigh"].ToString().Trim() == "1" ? true : false;
                                    policy.PolicyType    = dr["tickType"].ToString().Trim() == "1" ? "2" : "1";
                                    policy.PolicyType    = policy.PolicyType == "1" ? "BSP" : "B2B";
                                    policy.CarryCode     = dr["airComp"].ToString().Trim();
                                    if (dayOfWeek != DayOfWeek.Saturday && dayOfWeek != DayOfWeek.Sunday)
                                    {
                                        //周一到周五
                                        if (dr["workTime"].ToString().Split('-').Length == 2)
                                        {
                                            StartTime = dr["workTime"].ToString().Split('-')[0];
                                            EndTime   = dr["workTime"].ToString().Split('-')[1];
                                        }
                                        policy.WorkTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                        if (dr["workReturnTime"].ToString().Split('-').Length == 2)
                                        {
                                            StartTime = dr["workReturnTime"].ToString().Split('-')[0];
                                            EndTime   = dr["workReturnTime"].ToString().Split('-')[1];
                                        }
                                        policy.ReturnTicketTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                        policy.AnnulTicketTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                    }
                                    else
                                    {
                                        //周末
                                        if (dr["restWorkTime"].ToString().Split('-').Length == 2)
                                        {
                                            StartTime = dr["restWorkTime"].ToString().Split('-')[0];
                                            EndTime   = dr["restWorkTime"].ToString().Split('-')[1];
                                        }
                                        policy.WorkTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                        if (dr["restReturnTime"].ToString().Split('-').Length == 2)
                                        {
                                            StartTime = dr["restReturnTime"].ToString().Split('-')[0];
                                            EndTime   = dr["restReturnTime"].ToString().Split('-')[1];
                                        }
                                        policy.ReturnTicketTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                        policy.AnnulTicketTime = new StartAndEndTime()
                                        {
                                            StartTime = StartTime, EndTime = EndTime
                                        };
                                    }
                                    decimal.TryParse(dr["extReward"].ToString(), out ReturnMoney);
                                    policy.ReturnMoney = ReturnMoney;
                                    policy.CPOffice    = "";//易行适用航空公司大配置自动授权
                                    policy.Remark      = dr["memo"].ToString();
                                    decimal.TryParse(dr["disc"].ToString(), out PolicyPoint);
                                    policy.PolicyPoint = PolicyPoint;
                                    policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                    if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                    {
                                        continue;
                                    }
                                    policy.IsLow     = IsLow;
                                    policy.SeatPrice = SeatPrice;
                                    policy.ABFee     = TaxFare;
                                    policy.RQFee     = RQFare;
                                    //过滤不符合的政策点数
                                    if (PolicyPoint > 0 && PolicyPoint < 100)
                                    {
                                        PolicyList.Add(policy);
                                    }
                                }
                            }//foreach
                            //取前几条政策
                            if (platSystem != null)
                            {
                                PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                            }
                        }
                        else
                        {
                            //失败信息
                            string Message = dr_Price["Message"].ToString();
                        }
                    }
                }
                else
                {
                    throw new PnrAnalysisFailException(string.Format("PNR内容解析航段失败:{0}", pnrContent));
                }
            }
            return(PolicyList);
        }
Example #9
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            //获取区域对象
            string             area          = pnrModel._LegList[0].FromCode;
            _51BookAccountInfo accountInfo   = GetInfo(platSystem, area);
            string             _IsLowerPrice = IsLowPrice ? "1" : "0";
            //是否换编码出票 1:是
            string  _IsChangePNRCP = accountInfo._IsChangePNRCP;
            PTMange ptMange        = new PTMange();
            DataSet dsPolicy       = new DataSet();

            Logger.WriteLog(LogType.DEBUG, "51Book开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //System.Data.DataSet dsPolicy = m_PTService.PT_51BookGetPolicy(_51bookAccout, _51bookPassword, _51bookAg, _IsLowerPrice, pnrContent);
            //System.Data.DataSet dsPolicy = m_PTService.PT_New51BookGetPolicy(_51bookAccout, _51bookPassword, _51bookAg, _IsLowerPrice, pnrContent, PTPnrData);
            dsPolicy = ptMange._51BookGetPolicy(accountInfo._51bookAccout, accountInfo._51bookPassword, accountInfo._51bookAg, _IsLowerPrice, pnrContent, pnrData);
            Logger.WriteLog(LogType.DEBUG, "51Book结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");

            if (dsPolicy != null && dsPolicy.Tables.Count > 0)
            {
                if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                {
                    DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                    if (dr_Price["Status"].ToString() == "T")
                    {
                        decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                        decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                        decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                        decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                        bool IsLow = _IsLowerPrice == "1" ? true : false;

                        string            StartTime = "00:00", EndTime = "00:00";
                        decimal           PolicyPoint = 0m;
                        DataRowCollection drs         = dsPolicy.Tables[0].Rows;
                        foreach (DataRow dr in drs)
                        {
                            PlatformPolicy policy = new PlatformPolicy();
                            StartTime           = "00:00";
                            EndTime             = "00:00";
                            policy.Id           = dr["Id"] != DBNull.Value ? dr["Id"].ToString() : "";
                            policy.PlatformCode = this.Code;
                            policy.AreaCity     = area;
                            if (!string.IsNullOrEmpty(policy.Id))
                            {
                                //startDate                         政策开始生效日期
                                //expiredDate                       政策结束生效日期
                                //printTicketStartDate              政策出票开始生效日期
                                //printTicketExpiredDate            政策出票结束生效日期
                                //needSwitchPNR                     是否换编码出票 true是 false否
                                //routeType                         行程类型 OW单程 RT往返 否则联程
                                //businessUnitType                  是否是特殊政策  非0即是
                                //airlineCode                       航空格式二字码
                                //policyType                        B2P B2B
                                //flightCourse                      出发生成三字码 为"999-999"表示所有城市 格式:"出发城市三字码-到达城市三字码"
                                //flightNoIncluding                 适用航班号
                                //flightNoExclude                   不适用航班号
                                //flightCycle                       班期限制
                                //seatClass                         舱位
                                //comment                           政策备注
                                //Commission                        政策点数
                                //workTime                          供应工作时间
                                //chooseOutWorkTime                 退废票时间
                                //param2                            Office号
                                bool IsChangePNRCP = false;
                                bool.TryParse(dr["needSwitchPNR"].ToString(), out IsChangePNRCP);
                                policy.IsChangePNRCP = IsChangePNRCP;
                                policy.CarryCode     = dr["airlineCode"].ToString();
                                policy.IsSp          = dr["businessUnitType"].ToString() == "1" ? true : false;
                                policy.PolicyType    = string.Compare(dr["PolicyType"].ToString(), "B2P", true) == 0 ? "2" : "1";


                                policy.PolicyType = policy.PolicyType == "1" ? "BSP" : "B2B";
                                if (dr["workTime"].ToString().Split('-').Length == 2)
                                {
                                    StartTime = dr["workTime"].ToString().Split('-')[0];
                                    EndTime   = dr["workTime"].ToString().Split('-')[1];
                                }
                                policy.WorkTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                if (dr["chooseOutWorkTime"].ToString().Split('-').Length == 2)
                                {
                                    StartTime = dr["chooseOutWorkTime"].ToString().Split('-')[0];
                                    EndTime   = dr["chooseOutWorkTime"].ToString().Split('-')[1];
                                }
                                policy.ReturnTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.AnnulTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                decimal.TryParse(dr["Commission"].ToString(), out PolicyPoint);
                                policy.PolicyPoint = PolicyPoint;
                                policy.ReturnMoney = 0m;
                                policy.CPOffice    = dr["param2"].ToString();
                                policy.Remark      = dr["comment"].ToString();
                                policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                {
                                    continue;
                                }

                                policy.IsLow     = IsLow;
                                policy.SeatPrice = SeatPrice;
                                policy.ABFee     = TaxFare;
                                policy.RQFee     = RQFare;
                                //过滤不符合的政策点数
                                if (PolicyPoint > 0 && PolicyPoint < 100)
                                {
                                    PolicyList.Add(policy);
                                }
                            }
                        }//foreach
                        //取前几条政策
                        if (platSystem != null)
                        {
                            PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                        }
                    }
                    else
                    {
                        //失败信息
                        string Message = dr_Price["Message"].ToString();
                    }
                }
            }
            //转化
            return(PolicyList);
        }