Пример #1
0
        //工作
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            PP m = e.Argument as PP;

            if (m != null)
            {
                ParamInfo   PI = m.ll[0];
                ParamObject PM = new ParamObject();
                PM.ServerIP   = PI.IP;
                PM.ServerPort = int.Parse(PI.Port);
                PM.Office     = PI.Office;
                PnrAnalysis.FormatPNR format = new FormatPNR();
                int i = 1;
                foreach (string item in m.ticketList)
                {
                    if (item.Replace("-", "").Trim() != "")
                    {
                        //发送指令
                        PM.code = "detr:TN" + item.Replace("-", "").Trim();
                        string RecvData     = SendNewPID.SendCommand(PM);
                        string TicketStatus = format.GetTicketStatus(RecvData);
                        if (TicketStatus.ToUpper().Contains("OPEN FOR USE"))
                        {
                            m.resultList.Add(item);
                            LogWrite(item + "\r\n", path);
                        }
                        backgroundWorker1.ReportProgress((i * 100) / m.ticketList.Count, "发送:" + PM.code + "结果:" + RecvData);
                        Thread.Sleep(m.ScanJJ * 1000);
                    }

                    i++;
                }
                e.Result = m;
            }
        }
Пример #2
0
        /// <summary>
        /// 获取票号 PNR内容
        /// </summary>
        /// <param name="strRTicket"></param>
        /// <returns></returns>
        public List <string> GetTicketNum(string pnr, string strRTicket, FormatPNR format)
        {
            List <string> PTList  = new List <string>();
            string        msg     = "";
            PnrModel      PnrInfo = format.GetPNRInfo(pnr, strRTicket, false, out msg);

            foreach (PnrAnalysis.Model.TicketNumInfo item in PnrInfo._TicketNumList)
            {
                PTList.Add(item.TicketNum + "|" + item.PasName);
            }
            return(PTList);
        }
Пример #3
0
        public List <PbProject.Model.Tb_Ticket_Policy> GetPolicy(bool ChangePnr)
        {
            string errMsg = "";
            List <PbProject.Model.Tb_Ticket_Policy> mPolicyList = new List <Tb_Ticket_Policy>();

            try
            {
                List <PbProject.Model.Tb_Ticket_SkyWay> SkyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'");
                //if (_QXValue.Contains("") && SkyList.Count == 1)
                //{
                FormatPNR ss         = new FormatPNR();
                string    StartDate  = SkyList[0].FromDate.ToShortDateString();
                string    SecondDate = SkyList[0].FromDate.ToShortDateString();
                string    RTContent  = ss.RemoveHideChar(SkyList[0].NewPnrContent).Replace("\t", "").Replace("\n", "");
                string    PATContent = ss.RemoveHideChar(SkyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", "");
                bool      IsOnePrice = false;
                if (!SkyList[0].Space.Contains("1"))
                {
                    RTContent = ss.RemoveChildSeat(RTContent, out IsOnePrice);
                }
                DataSet ds8000Y = _8000yiService.SPbyPNRNote(_8000yiAccout, _8000yiPassword, _order.PNR, 0, RTContent);
                if (ds8000Y.Tables.Count > 0)
                {
                    if (ds8000Y.Tables[0].Rows.Count > 0)
                    {
                        try
                        {
                            //  对方接口报错
                            errMsg = ds8000Y.Tables[0].Rows[0]["errInfo"].ToString();
                        }
                        catch
                        {
                            //  返回正常
                            mPolicyList = Merger8000YDT(ds8000Y.Tables[0].Select("A10<='" + StartDate + " 00:00:00' and A11>='" + SecondDate + " 00:00:00'"), _mTopcom, ChangePnr);
                            //Update8000YInterFcae(ds8000Y);
                        }
                    }
                }
                //}
            }
            catch (Exception ex)
            {
                //errorData51book = "1";
                //OnError("整体线程异常," + ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get8000YPol");
            }
            if (errMsg != "")
            {
                //errorData51book = "1";
            }
            return(mPolicyList);
        }
Пример #4
0
        public static PnrData GetPnrData(string pnrContent)
        {
            FormatPNR   format      = new FormatPNR();
            string      Msg         = string.Empty;
            SplitPnrCon splitPnrCon = format.GetSplitPnrCon(pnrContent);
            string      RTCon       = splitPnrCon.RTCon;
            string      PatCon      = splitPnrCon.AdultPATCon != string.Empty ? splitPnrCon.AdultPATCon : splitPnrCon.ChdPATCon;
            string      Pnr         = format.GetPNR(RTCon, out Msg);
            PnrModel    pnrMode     = format.GetPNRInfo(Pnr, RTCon, false, out Msg);
            //成人或者儿童PAT
            PatModel patMode = format.GetPATInfo(PatCon, out Msg);

            return(new PnrData()
            {
                PnrMode = pnrMode,
                PatMode = patMode
            });
        }
Пример #5
0
        /// <summary>
        /// 获取经停信息
        /// </summary>
        /// <param name="businessmanCode">分销商户号</param>
        /// <param name="flightNo">航班号  CA4193</param>
        /// <param name="flyDate">起飞(经停)日期</param>
        /// <returns></returns>
        public LegStop GetLegStop(string businessmanCode, string flightNo, DateTime flyDate)
        {
            //FF:CA4193/30JUL14
            var cmd = string.Format("FF:{0}/{1}", flightNo.Trim(),
                                    FormatPNR.DateToStr(flyDate.ToString("yyyy-MM-dd"), DataFormat.dayMonthYear));
            var strRecvData = PidService.SendCmd(businessmanCode, cmd, "");

            strRecvData = strRecvData.Replace("^", "\r");
            var result   = string.Empty;
            var stopInfo = new FormatPNR().GetStop(strRecvData, out result);

            if (!string.IsNullOrEmpty(result))
            {
                Logger.WriteLog(LogType.ERROR, result);
            }
            ;
            return(stopInfo);
        }
Пример #6
0
 /// <summary>
 /// FD计算折扣 保留两位小数
 /// </summary>
 /// <param name="fditem"></param>
 /// <param name="YFdItem"></param>
 /// <returns></returns>
 private FdItemData JiSuanPrice(FdItemData fditem, List <FdItemData> YFdItem)
 {
     if (YFdItem != null && YFdItem.Count > 0)
     {
         FdItemData fdYitem = YFdItem.Find(delegate(FdItemData yfd)
         {
             if (yfd.Carry.Trim().ToUpper() == fditem.Carry.Trim().ToUpper())
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         });
         if (fdYitem != null)
         {
             fditem.DiscountRate = FormatPNR.GetZk(fdYitem.Fare1, fditem.Fare1).ToString();
         }
     }
     return(fditem);
 }
Пример #7
0
        public List <PbProject.Model.Tb_Ticket_Policy> GetPolicy(bool ChangePnr)
        {
            List <PbProject.Model.Tb_Ticket_Policy> mPolicyList = new List <Tb_Ticket_Policy>();

            try
            {
                //if (_QXValue.Contains(""))//控台517开关是否打开
                //{
                List <PbProject.Model.Tb_Ticket_SkyWay> skyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'");
                string StartDate  = "";
                string SecondDate = "";
                StartDate  = skyList[0].FromDate.ToShortDateString();
                SecondDate = skyList[0].FromDate.ToShortDateString();
                PnrAnalysis.FormatPNR ss = new FormatPNR();
                string RTContent         = ss.RemoveHideChar(skyList[0].NewPnrContent).Replace("\r", "").Replace("\t", "").Replace("\n", "");
                string PATContent        = ss.RemoveHideChar(skyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", "");
                if (skyList.Count > 1)
                {
                    SecondDate = skyList[1].FromDate.ToShortDateString();
                }
                //获取517政策
                DataSet ds517 = new DataSet();
                try
                {
                    ds517 = _517Service.GetBenefitDataPnrContent(_517Accout, _517Password, _517Ag, RTContent, PATContent, _order.PNR);
                }
                catch (Exception e)
                {
                }

                if (ds517.Tables.Count > 0)
                {
                    try
                    {
                        DataTable NewDt = ds517.Tables[0].Clone();
                        NewDt.Columns["EffectDate"].DataType     = typeof(DateTime);
                        NewDt.Columns["ExpirationDate"].DataType = typeof(DateTime);
                        foreach (DataRow dr in ds517.Tables[0].Rows)
                        {
                            DataRow NewDr = NewDt.NewRow();
                            for (int i = 0; i < ds517.Tables[0].Columns.Count; i++)
                            {
                                NewDr[i] = dr[i].ToString();
                            }
                            NewDt.Rows.Add(NewDr);
                        }
                        mPolicyList = Merger517DT(NewDt.Select("EffectDate<='" + StartDate + " 00:00:00' and ExpirationDate>='" + SecondDate + " 23:59:59'"), _mTopcom, ChangePnr);
                    }
                    catch (Exception ex)
                    {
                        //errorData517 = "1";
                        //OnError(ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get517Pol");
                    }
                }
            }
            //}
            catch (Exception ex)
            {
                //errorData517 = "1";
                //OnError("整体线程异常," + ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get517Pol");
            }
            return(mPolicyList);
        }
Пример #8
0
        public void TestPid()
        {
            string ss = "";

            //BootStrapper.Boot();
            //AuthManager.SaveUser(new BPiaoBao.SystemSetting.Domain.Services.Auth.CurrentUserInfo()
            //{
            //    Code = "5131010006",
            //    OperatorAccount = "何静",
            //    OperatorName = "苏苏"
            //});
            ////OrderService orderService = ObjectFactory.GetInstance<OrderService>();
            //FlightService flightService = ObjectFactory.GetInstance<FlightService>();
            //TravelAppRequrst travelAppRequrst = new TravelAppRequrst()
            //{
            //    CreateOffice = "CTU186",
            //    OrderId = "05562703510376942401",
            //    PassengerId = 149425,
            //    TicketNumber = "7842145067778",
            //    TripNumber = "6377705171"
            //};
            //TravelAppResponse travelAppResponse = flightService.VoidTrip(travelAppRequrst);
            //return;

            //OrderDto orderdto = orderService.ChoosePolicy("517", "9789867~", "05747392918379086547");

            //OrderDto orderdto = orderService.ChoosePolicy("05747392918379086547");

            // DomesticService domesticService = ObjectFactory.GetInstance<DomesticService>();
            // domesticService.AutoIssue("5453763231711235650", "婴儿测试");
            // domesticService.CreatePlatformOrderAndPaid("04882623127929209734", "11", "测试");

            //string pnrContent = @"1.黄月群 2.兰崇军 3.罗彬 4.宋小平 5.王荟 6.徐铭 7.杨中 8.张训华 9.朱光甫 JT1NN410.  CZ3447 M   TH18SEP  WUHCTU HK9   0810 0950          E --T211.CTU/T CTU/T 028-85512345/CTU HUA LONG AIR SERVICE CO.,LTD/YANGHONG ABCDEFG12.REM 0904 1646 SHENYI0113.BY OPT 8835 2014/09/04 1646A14.TL/1946/04SEP/CTU18615.SSR FOID CZ HK1 NI513822198608114841/P116.SSR FOID CZ HK1 NI510104198112264113/P917.SSR FOID CZ HK1 NI513622198312050315/P218.SSR FOID CZ HK1 NI511524198908080078/P819.SSR FOID CZ HK1 NI510524198509070779/P320.SSR FOID CZ HK1 NI510522197405120973/P421.SSR FOID CZ HK1 NI510104198012084107/P522.SSR FOID CZ HK1 NI513027197605264610/P623.SSR FOID CZ HK1 NI510802197409130715/P724.SSR ADTK 1E BY CTU05SEP14/1646 OR CXL CZ BOOKING25.OSI CZ CTCT02896567                                                         +26.RMK CA/MBSKT1                                                               -27.CTU186
            //";
            // pnrContent = @" 1.尚福乐  JFBNCZ\r 2.  CA4193 G   WE19NOV  CTUPEK HK1   0700 0935          E T2T3                \r 3.SHE/T SHE/T024-86853111/SHENYANGZHONGYUANGUOJIHANGKONGFUWUYOUXIANGONGSI/    \r    /MENG JING TAN ABCDEFG\r 4.013940582959\r 5.TL/0530/19NOV/SHE185\r 6.SSR FOID CA HK1 NI211322198509260317/P1\r 7.SSR ADTK 1E BY SHE12NOV14/0700 OR CXL CA ALL SEGS\r 8.OSI YY CTCT013940582959\r 9.OSI CA CTCT13541362279\r10.OSI CA CTCM15820648302/P1                                                  +3.4%利润2.80支付总金额861.20\r支付出票请登录: HTTP://WWW.86853111.NET\r 重要通知:所有用户不得加价销售机票,如有航司罚款追讨赔偿 \r11.OSI CA CTCT13940582959                                                     -\r12.RMK CA/MX6F2H\r13.RMK QQ1024593972\r14.RMK TLWBINSD\r15.SHE1853.4%利润2.80支付总金额861.20\r支付出票请登录: HTTP://WWW.86853111.NET\r 重要通知:所有用户不得加价销售机票,如有航司罚款追讨赔偿 \r\r";
            //            pnrContent = @">PAT:A
            //01 G FARE:CNY440.00 TAX:CNY50.00 YQ:CNY60.00  TOTAL:550.00
            // SFC:01    SFN:01
            //02 G/CA4Z142374 FARE:CNY400.00 TAX:CNY50.00 YQ:CNY60.00  TOTAL:510.00
            // SFC:02    SFN:02
            //";
            string err        = "";
            string pnrContent = @"1.代涛 2.张娟 HVR0VP   3.  MU5856 B   TH23OCT  CTUKMG HK2   1540 1710          E T2--   4.CTU/T CTU/T028-85555666/CHENG DU FENG XU HANG KONG PIAO WU FU WU YOU XIAN       GONG SI/LIUX ABCDEFG   5.REM 1023 0844 JPSG02 13658034125   6.023-62973108   7.TL/1000/23OCT/CTU373   8.SSR FOID MU HK1 NI522323197508170526/P2   9.SSR FOID MU HK1 NI53012819961127151X/P1  10.SSR CKIN MU  11.SSR FQTV MU HK1 CTUKMG 5856 B23OCT MU660283321266/P2  12.SSR ADTK 1E BY CTU23OCT14/1216 OR CXL MU5856 B23OCT  13.OSI MU CTCT13436009296  14.RMK CA/MEV5DC  15.RMK TJ AUTH CTU186  16.CTU373           >PAT:A  01 B FARE:CNY980.00 TAX:CNY50.00 YQ:CNY50.00  TOTAL:1080.00   SFC:01";

            PnrAnalysis.FormatPNR format = new FormatPNR();
            //PatModel pat = format.GetPATInfo(pnrContent, out err);


            //List<string> strList = format.NewSplitPnr(pnrContent);
            //string err = "";
            //PnrAnalysis.Model.SplitPnrCon splitPnrCon = format.GetSplitPnrCon(pnrContent);
            //string RTCon = splitPnrCon.RTCon;
            //string PatCon = splitPnrCon.AdultPATCon != string.Empty ? splitPnrCon.AdultPATCon : splitPnrCon.ChdPATCon;
            //PatModel pat = format.GetPATInfo(PatCon, out err);
            //PnrModel pnrmodel = format.GetPNRInfo("JT1NN4", pnrContent, false, out err);

            //////去重复和备注
            //string pnrRemark = string.Empty;
            //RTCon = format.DelRepeatRTCon(RTCon, ref pnrRemark);
            //if (!string.IsNullOrEmpty(pnrRemark))
            //{
            //    PatCon = PatCon.Replace(pnrRemark, "");
            //}

            // PnrModel pnr = pnrformat.GetPNRInfo("JXNWW5",pnrContent,false,out err);

            return;

            //var  domesticService.PnrIsPay();
            //domesticService.SetOrderStatusInvalid("", "JGKK47", "05304779119416242765");
            // ss = "O FM:1PEK 3U    8886  P 06AUG 1520 OK HCY                      20K OPEN FOR USE      T3T1 RL:NKX89L  /";
            // string strSky = @"(\s*O\s*(?<dentity>FM|TO)\:(?<fnum>\d)(?<from>[A-Za-z]{3})\s*(?<carray>[a-zA-Z0-9]{2})\s*(?<flightno>\d{3,5})\s*(?<seat>[A-Za-z]{1}\d?)\s*(?<date>\d{2}[A-Za-z]{3}(\d{2})?)\s*(?<startTime>[^\d]{0,}\d{4})\s*OK\s*[A-Za-z]{1}\d?\s*((.*\/.*)|[a-zA-Z]{3}\d{1,2}|[a-zA-Z]{2})?\s*(?<packet>\d{2}K)\s*(?<status>.*)\s*(?<eterm>[T|\d|\-]{4})?\s*(.{3})(?<bigpnr>[a-zA-Z0-9]{6})?\s*.((?<pnr>[a-zA-Z0-9]{6})\s*.{2})?)";
            //// string strExchData = @"(?<=\s*EXCH\:\s*(?<tk>\d{3,4}[-]?\d{10})\s*CONJ\s*TKT\:.*?\s*)(?<exchData>[\s|\S]+)\s*TO\:\s*(?<to>[A-Za-z]{3})\s*";
            // //航段
            // Match match = Regex.Match(ss, strSky, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);

            // if (match.Success)
            // {

            // }
            // return;
            //PnrAnalysis.FormatPNR format = new PnrAnalysis.FormatPNR();
            // format.GetDetr(ss);
            //format.GetDetrS(ss);
            //AuthManager.SaveUser(new BPiaoBao.SystemSetting.Domain.Services.Auth.CurrentUserInfo()
            //{
            //    Code = "5110270005",
            //    OperatorAccount = "徐均",
            //    OperatorName = "四川华电航空票务服务公司翔安分公司"
            //});

            //   OrderService orderService = ObjectFactory.GetInstance<OrderService>();
            //  string aaa = orderService.QueryPayStatus("04809550518362161518");
            //return;
            //orderService.AddCoordinationDto("05402303911461036293", "121", "jkjkjkjj", false);
            //string msg = "";
            //string aaa = format.GetPnrStatus(ss, out msg);



            //04750648053131210303

            // PolicyService policyService = ObjectFactory.GetInstance<PolicyService>();
            // policyService.test();

            //PolicyQueryParam policyQueryParam = new PolicyQueryParam();
            //policyQueryParam.TravelType = TravelType.Oneway;
            //policyQueryParam.InputParam = new List<QueryParam>();
            //policyQueryParam.InputParam.Add(new QueryParam()
            //{
            //    FromCode = "CTU",
            //    ToCode = "PEK",
            //    FlyDate = "2014-06-20"
            //});
            //List<PolicyCache> policyCacheList = policyService.GetFlightPolicy("123", policyQueryParam);



            //return;


            //PidService pidService = ObjectFactory.GetInstance<PidService>();
            //string result = pidService.GetAV("test01", "ctu", "pek", "", "2014-08-20", "0000");
            // string strData = pidService.GetPnrAndTickeNumInfo("c1001", "", "CTU324");
            // OrderService orderService = ObjectFactory.GetInstance<OrderService>();
            //orderService.AddCoordinationDto();

            // currentUser = AuthManager.GetCurrentUser();

            //AuthManager.SaveUser(new BPiaoBao.SystemSetting.Domain.Services.Auth.CurrentUserInfo()
            //{
            //    Code = "",
            //    OperatorAccount = ""
            //});

            // PolicyPack pack = orderService.GetPolicyList("05407898320500536131");

            //RequestSplitPnrInfo request = new RequestSplitPnrInfo();
            //request.BusinessmanCode = "c7516";
            //request.Office = "CTU186";
            //request.Pnr = "HQG9FS";
            //request.SplitPasList = new List<SplitPassenger>() {
            //    new  SplitPassenger(){
            //         PassengerName="张阳"

            //    }
            //};
            //ResposeSplitPnrInfo response = pidService.SplitPnr(request);

            //            string strPnr = @"  3U8737  L TH17JUL  CTUCAN DK1   0715 0930
            //HFEMDE -   航空公司使用自动出票时限, 请检查PNR
            //  *** 预订酒店指令HC, 详情   HC:HELP   ***
            //";

            //            strPnr = @" 1.李国瑞 HZPGDY
            // 2.  3U8701 E   TH26JUN  CTUSZX HK1   0705 0915          E T1T3
            // 3.CTU/T CTU/T 028-5566222/CTU QI MING INDUSTRY CO.,LTD/TONG LILI ABCDEFG
            // 4.TL/0605/26JUN/CTU324
            // 5.SSR FOID 3U HK1 NI220122198205162232/P1
            // 6.SSR FQTV 3U HK1 CTUSZX 8701 E26JUN 3U981209305/C/P1
            // 7.OSI 3U CTCM18608021562/P1
            // 8.OSI 3U CTCT13541362279
            // 9.RMK CA/MT0CZB
            //10.CTU324
            // 1.李国瑞 HZPGDY
            // 2.  3U8701 E   TH26JUN  CTUSZX HK1   0705 0915          E T1T3
            //     -CA-MT0CZB
            // 3.CTU/T CTU/T 028-5566222/CTU QI MING INDUSTRY CO.,LTD/TONG LILI ABCDEFG
            // 4.TL/0605/26JUN/CTU324
            // 5.SSR FOID 3U HK1 NI220122198205162232/P1
            // 6.SSR FQTV 3U HK1 CTUSZX 8701 E26JUN 3U981209305/C/P1
            // 7.OSI 3U CTCM18608021562/P1
            // 8.OSI 3U CTCT13541362279
            // 9.RMK CA/MT0CZB
            //10.CTU324
            //";
            //            string errMsg = "";
            //            //string Pnr = format.GetBigCode(strPnr, out errMsg);
            //            string strData = format.DelRepeatRTCon(strPnr, ref errMsg);
            //            //decimal DownPoint = 6.9m;
            //            //string d = DownPoint.ToString("F2");
            //            return;


            //            BusinessmanRepository businessmanRepository = ObjectFactory.GetInstance<BusinessmanRepository>();
            //            FlightDestineService flightDestineService = ObjectFactory.GetInstance<FlightDestineService>();
            //            //new FlightDestineService(businessmanRepository);
            //            DestineRequest destine = new DestineRequest();
            //            destine.Passengers = new PassengerRequest[] {
            //                //成人
            //                new PassengerRequest(){
            //                     CardNo="1236547890",
            //                     ChdBirthday=System.DateTime.Now,
            //                     LinkPhone="13610001236",
            //                     MemberCard="",
            //                     PassengerName="刘飞",
            //                     PassengerType=1
            //                }
            //                /*,
            //                //儿童
            //                new PassengerRequest(){
            //                     CardNo="420821198710072011",
            //                     ChdBirthday=System.DateTime.Now,
            //                     LinkPhone="15928636275",
            //                     MemberCard="",
            //                     PassengerName="王冰",
            //                     PassengerType=2
            //                },
            //                 //婴儿
            //                new PassengerRequest(){
            //                     CardNo="652328194203150011",
            //                     ChdBirthday=System.DateTime.Now,
            //                     LinkPhone="15928636271",
            //                     MemberCard="",
            //                     PassengerName="王婴",
            //                     PassengerType=3
            //                }*/
            //            };
            //            destine.SkyWay = new DestineSkyWayRequest[]{
            //                new DestineSkyWayRequest(){
            //                       CarrayCode="CA",
            //                       FlightNumber="1405",
            //                       StartDate=DateTime.Parse("2014-12-01 07:00:00"),
            //                       EndDate=DateTime.Parse("2014-12-01 09:45:00"),
            //                       FromCityCode="PEK",
            //                       ToCityCode="CTU"  ,
            //                       Seat="Y"
            //                }
            //            };
            //            destine.Tel = "13610001000";
            //            //flightDestineService.Destine(destine);
            //            PolicyPack pp = orderService.Destine(destine, Common.Enums.EnumDestineSource.MobileDestine);

            //            return;
            //            PnrImportParam pnrImportParam = new PnrImportParam();
            //            pnrImportParam.PnrAndPnrContent = @" 1.王芬 JZ5WGL
            // 2.  3U8881 Y   MO28JUL  CTUPEK HK1   0730 1005          E T1T3
            // 3.CTU/T CTU/T 028-85512345/CTU HUA LONG AIR SERVICE CO.,LTD/YANGHONG ABCDEFG
            // 4.TL/0600/28JUL/CTU186
            // 5.SSR FOID 3U HK1 NI420821198710072018/P1
            // 6.SSR ADTK 1E BY CTU16JUN14/1418 OR CXL 3U8881 Y28JUL
            // 7.OSI 3U CTCM15928636274/P1
            // 8.RMK CA/MF82RZ
            // 9.CTU186
            //>PAT:A
            //01 Y FARE:CNY1440.00 TAX:CNY50.00 YQ:CNY120.00  TOTAL:1610.00
            // SFC:01
            //";
            //            pnrImportParam.PnrImportType = EnumPnrImportType.GenericPnrImport;
            //            pnrImportParam.OldOrderId = "";
            //            PolicyPack policyPack = orderService.ImportPnrContext(pnrImportParam);


            //            ConsoLocalPolicyService policy = ObjectFactory.GetInstance<ConsoLocalPolicyService>();
            //            CabinData cabinData = policy.GetBaseCabinData("CA");
        }
Пример #9
0
        public List <PbProject.Model.Tb_Ticket_Policy> GetPolicy(bool ChangePnr)
        {
            List <PbProject.Model.Tb_Ticket_Policy> mPolicyList = new List <Tb_Ticket_Policy>();

            try
            {
                //if (_QXValue.Contains(""))//控台517开关是否打开
                //{
                List <PbProject.Model.Tb_Ticket_SkyWay> skyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'");
                string StartDate  = "";
                string SecondDate = "";
                StartDate  = skyList[0].FromDate.ToShortDateString();
                SecondDate = skyList[0].FromDate.ToShortDateString();
                PnrAnalysis.FormatPNR ss = new FormatPNR();
                string RTContent         = ss.RemoveHideChar(skyList[0].NewPnrContent).Replace("\r", "").Replace("\t", "").Replace("\n", "");
                string PATContent        = ss.RemoveHideChar(skyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", "");
                if (skyList.Count > 1)
                {
                    SecondDate = skyList[1].FromDate.ToShortDateString();
                }
                //获取517政策
                DataSet dsYeeXing = new DataSet();
                try
                {
                    dsYeeXing = _yeeXingService.ParsePnrMatchAirpContract(_yeeXingAccout, _yeeXingAccout2, _order.PNR, RTContent, PATContent);
                }
                catch (Exception e)
                {
                }

                if (dsYeeXing.Tables.Count > 0)
                {
                    try
                    {
                        DataTable NewDt = dsYeeXing.Tables[5].Clone();
                        NewDt.Columns.Add("startTime", typeof(DateTime));
                        NewDt.Columns.Add("endTime", typeof(DateTime));
                        NewDt.Columns.Add("airComp", typeof(String));
                        NewDt.Columns.Add("airSeg", typeof(int));
                        NewDt.Columns.Add("orgCity", typeof(String));
                        NewDt.Columns.Add("dstCity", typeof(String));
                        NewDt.Columns.Add("flight", typeof(String));
                        NewDt.Columns.Add("cabin", typeof(String));

                        foreach (DataRow dr in dsYeeXing.Tables[5].Rows)
                        {
                            DataRow NewDr = NewDt.NewRow();
                            for (int i = 0; i < dsYeeXing.Tables[5].Columns.Count; i++)
                            {
                                NewDr[i] = dr[i].ToString();
                            }
                            NewDr["startTime"] = dsYeeXing.Tables[2].Rows[0]["startTime"];
                            NewDr["endTime"]   = dsYeeXing.Tables[2].Rows[0]["endTime"];
                            NewDr["airComp"]   = dsYeeXing.Tables["lineinfo"].Rows[0]["airComp"];
                            NewDr["orgCity"]   = dsYeeXing.Tables["lineinfo"].Rows[0]["orgCity"];
                            NewDr["dstCity"]   = dsYeeXing.Tables["lineinfo"].Rows[0]["dstCity"];
                            NewDr["flight"]    = "";
                            NewDr["cabin"]     = dsYeeXing.Tables["lineinfo"].Rows[0]["cabin"];
                            NewDr["airSeg"]    = dsYeeXing.Tables["lineinfos"].Rows[0]["airSeg"];
                            NewDt.Rows.Add(NewDr);
                        }
                        mPolicyList = MergerYeeXingDT(NewDt.Select("1=1"), _mTopcom, ChangePnr);
                    }
                    catch (Exception ex)
                    {
                        //errorData517 = "1";
                        //OnError(ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get517Pol");
                    }
                }
            }
            //}
            catch (Exception ex)
            {
                //errorData517 = "1";
                //OnError("整体线程异常," + ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get517Pol");
            }
            return(mPolicyList);
        }
Пример #10
0
        public static PolicyDto ToPolicyDto(this Policy policy, Order order)
        {
            DataBill databill   = new DataBill();
            decimal  PayMoney   = databill.GetPayPrice(policy.SeatPrice, policy.ABFee, policy.RQFee, policy.PolicyPoint, policy.ReturnMoney);
            decimal  Commission = databill.GetCommission(policy.PolicyPoint, policy.SeatPrice, policy.ReturnMoney);
            var      _p         = new PolicyDto()
            {
                Commission             = Commission,
                AreaCity               = policy.AreaCity,
                Id                     = policy.PolicyId,
                PlatformCode           = policy.PlatformCode,
                PlatformName           = policy.PlatformCode,
                Point                  = policy.PolicyPoint,
                DownPoint              = policy.DownPoint,
                PaidPoint              = policy.PaidPoint,
                OriginalPolicyPoint    = policy.OriginalPolicyPoint,
                ReturnMoney            = policy.ReturnMoney,
                IsChangePNRCP          = policy.IsChangePNRCP,
                IssueTicketWay         = ((int)policy.EnumIssueTicketWay).ToString(),
                IsSp                   = policy.IsSp,
                IsLow                  = policy.IsLow,
                PolicyType             = policy.PolicyType,
                WorkTime               = policy.WorkTime.ToString(),
                ReturnTicketTime       = policy.ReturnTicketTime.ToString(),
                AnnulTicketTime        = policy.AnnulTicketTime.ToString(),
                TFGTime                = FormatPNR.GetIntersectionTimeSlot(policy.ReturnTicketTime.ToString(), policy.AnnulTicketTime.ToString()),
                CPOffice               = policy.CPOffice,
                IssueSpeed             = policy.IssueSpeed,
                Remark                 = policy.Remark,
                PolicySourceType       = EnumItemManager.GetDesc(policy.PolicySourceType),
                CarryCode              = policy.CarryCode,
                PolicyOwnUserRole      = ((int)policy.PolicyOwnUserRole).ToString(),
                Code                   = policy.Code,
                Name                   = policy.Name,
                CashbagCode            = policy.CashbagCode,
                Rate                   = policy.Rate,
                CarrierCode            = policy.CarrierCode,
                SeatPrice              = policy.SeatPrice,
                ABFee                  = policy.ABFee,
                RQFee                  = policy.RQFee,
                TicketPrice            = policy.SeatPrice + policy.ABFee + policy.RQFee,
                PayMoney               = PayMoney,
                DefaultPolicySource    = order.OrderType,
                PolicySpecialType      = policy.PolicySpecialType,
                SpecialPriceOrDiscount = policy.SpecialPriceOrDiscount,
                TodayGYCode            = policy.TodayGYCode
            };
            var currentUser = AuthManager.GetCurrentUser();

            if (currentUser.Type == "Buyer")
            {
                _p.ShowPolicySource = EnumItemManager.GetDesc(policy.PolicySourceType);
            }
            else if (currentUser.Type == "Carrier")
            {
                if (policy.PolicySourceType != EnumPolicySourceType.Local)
                {
                    _p.ShowPolicySource = "系统";
                }
                else if (currentUser.Code == policy.Code)
                {
                    _p.ShowPolicySource = policy.PolicyType;
                }
                else
                {
                    _p.ShowPolicySource = policy.Code;
                }
            }
            else if (currentUser.Type == "Supplier")
            {
                _p.ShowPolicySource = policy.PolicyType;
            }
            else
            {
                if (policy.PolicySourceType == EnumPolicySourceType.Interface)
                {
                    _p.ShowPolicySource = policy.PlatformCode;
                }
                else
                {
                    _p.ShowPolicySource = policy.Code;
                }
            }
            return(_p);
        }
Пример #11
0
        /// <summary>
        /// 解析FD数据
        /// </summary>
        /// <param name="FdDataList"></param>
        /// <returns></returns>
        public FDModel GetFDData(List <string> FdDataList)
        {
            bool IsGetHeader = false;
            //是否计算折扣
            bool    IsJSPrice = true;
            FDModel fdmodel   = new FDModel();

            foreach (string item in FdDataList)
            {
                string[] strArr = item.Split(new string[] { "\r" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var fdItem in strArr)
                {
                    if (!fdItem.StartsWith("PFD") && !fdItem.StartsWith("FD:"))
                    {
                        //每项数据处理
                        string FdPattern = @"\s*(?<num>\d{1,3})\s*(?<Carry>\w{2})\/(?<Seat>\w+)\s*\/\s*(?<Fare1>[\d|\.]+)\=\s*(?<Fare2>[\d|\.]+)\s*\/(?<seat1>\w{1,2})\/(?<seat2>\w{1,2})\/\s*\/\s*\.\s*\/(?<date>.*?)\s*\/(?<Orther>\w+)\s*";
                        Match  mchFd     = Regex.Match(fdItem, FdPattern, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);
                        if (mchFd.Success)
                        {
                            FdItemData fditem = new FdItemData();
                            fditem.num    = mchFd.Groups["num"].Value.Replace("", "");
                            fditem.Carry  = mchFd.Groups["Carry"].Value.Replace("", "");
                            fditem.Seat   = mchFd.Groups["Seat"].Value.Replace("", "");
                            fditem.Fare1  = mchFd.Groups["Fare1"].Value.Replace("", "");
                            fditem.Fare2  = mchFd.Groups["Fare2"].Value.Replace("", "");
                            fditem.seat1  = mchFd.Groups["seat1"].Value.Replace("", "");
                            fditem.seat2  = mchFd.Groups["seat2"].Value.Replace("", "");
                            fditem.date   = FormatPNR.GetYMD(mchFd.Groups["date"].Value.Replace("", ""), DataFormat.dayMonthYear);
                            fditem.Orther = mchFd.Groups["Orther"].Value.Replace("", "");
                            fdmodel.FdDataList.Add(fditem);
                            if (fditem.Seat.Trim().ToUpper() == "Y")
                            {
                                fdmodel.FdYDataList.Add(fditem);
                            }
                        }
                    }
                    else
                    {
                        if (!IsGetHeader)
                        {
                            string FdPattern = @"(?<=FD:)\s*(?<city>.*?)\/(?<date>.*?)\/\s*.*?(?<=\/TPM)\s*(?<Mileage>\d+)\/\s*";
                            Match  mchFd     = Regex.Match(fdItem, FdPattern, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);
                            if (mchFd.Success)
                            {
                                string city    = mchFd.Groups["city"].Value.Trim().ToUpper().Replace("", "");
                                string date    = mchFd.Groups["date"].Value.Trim().Replace("", "");
                                string Mileage = mchFd.Groups["Mileage"].Value.Trim() == "" ? "0" : mchFd.Groups["Mileage"].Value.Trim();
                                fdmodel.fdMileage = Mileage.Replace("", "");
                                fdmodel.fdDate    = FormatPNR.GetYMD(date, DataFormat.dayMonthYear);
                                fdmodel.strDate   = date;
                                fdmodel.fromCode  = city.Substring(0, 3);
                                fdmodel.toCode    = city.Substring(3);
                                IsGetHeader       = true;
                            }
                        }
                    }
                } //数据
            }     //PN
            if (IsJSPrice)
            {
                for (int i = 0; i < fdmodel.FdDataList.Count; i++)
                {
                    JiSuanPrice(fdmodel.FdDataList[i], fdmodel.FdYDataList);
                }
            }
            fdmodel.TotalCount = fdmodel.FdDataList.Count.ToString();
            return(fdmodel);
        }
Пример #12
0
        /// <summary>
        /// 格式化具体指令返回
        /// </summary>
        /// <param name="SendIns"></param>
        /// <param name="code"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public InsModel FormatIns(SendDataHandler SendIns, ParamObject pm, InsType type)
        {
            InsModel IModel = new InsModel();

            if (SendIns != null)
            {
                if (!pm.code.ToLower().Trim().StartsWith("detr:"))
                {
                    //发送指令
                    string strRecvData = SendIns(pm);
                    int    MaxPNCount  = 6;//最大PN数
                    if (type == InsType.AVH)
                    {
                        List <string> avhList = new List <string>();
                        avhList.Add(strRecvData);
                        pm.code = "PN";
                        Thread.Sleep(pm.PNSleep);
                        strRecvData = SendIns(pm);
                        int i = 0;
                        while (i < MaxPNCount)
                        {
                            if (strRecvData.Contains("下一页") || strRecvData == avhList[avhList.Count - 1])
                            {
                                break;
                            }
                            else
                            {
                                if (!strRecvData.Contains("指令频繁"))
                                {
                                    avhList.Add(strRecvData);
                                }
                                strRecvData = SendIns(pm);
                                Thread.Sleep(pm.PNSleep);
                                i++;
                            }
                        }
                        IModel._avh = GetAVHData(avhList);
                    }
                    else if (type == InsType.FD)
                    {
                        #region 获取FD数据
                        if (!strRecvData.Contains("没有适用运价"))
                        {
                            //FD数据列表
                            List <string> FdList = new List <string>();
                            FdList.Add(strRecvData);
                            int    PageIndex = 1, PageCount = 1;
                            string PagePattern = @"(?<=PAGE)\s*(?<PageIndex>\d+)\/(?<PageCount>\d+)\s*";
                            Match  PageMch     = Regex.Match(strRecvData, PagePattern, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);
                            if (PageMch.Success)
                            {
                                int.TryParse(PageMch.Groups["PageIndex"].Value.Trim(), out PageIndex);
                                int.TryParse(PageMch.Groups["PageCount"].Value.Trim(), out PageCount);
                            }
                            if (PageIndex != PageCount)
                            {
                                for (int i = PageIndex; i < PageCount; i++)
                                {
                                    pm.code     = "PN";
                                    strRecvData = SendIns(pm);
                                    FdList.Add(strRecvData);
                                }
                            }
                            IModel._fd = GetFDData(FdList);
                        }
                        #endregion
                    }
                    else if (type == InsType.PAT)
                    {
                        FormatPNR pnr    = new FormatPNR();
                        string    errMsg = "";
                        IModel._pat = pnr.GetPATInfo(strRecvData, out errMsg);
                    }
                }
                else
                {
                    if (type == InsType.Detr)
                    {
                        List <string> avhList = new List <string>();
                        IModel._detr = GetDetrModel(avhList, SendIns, pm);
                    }
                }
            }
            return(IModel);
        }
Пример #13
0
        public Order CreateOrderByPnrContent(Order order, string pnrContent, EnumPnrImportType PnrImportType, CreateOrderParam OrderParam, string businessmanCode, string CarrierCode, string businessmanName, string account, bool IsChangePnrTicket)
        {
            #region 验证PNR
            if (pnrContent.ToUpper().Contains("NO PNR"))
            {
                pnrContent = pnrContent.ToUpper().Replace("NO PNR", "");
            }
            FormatPNR format = new FormatPNR();
            if (format.GetPnrContentByteLength(pnrContent) > 2000)
            {
                throw new PnrAnalysisFailException("RT和PAT内容长度超出范围[0-2000]个字符,请去掉多余的空格,再导入!");
            }
            if (pnrContent.Trim().Contains("授权"))
            {
                throw new PnrAnalysisFailException(pnrContent);
            }
            if (pnrContent.Trim().Contains("数据包不完整"))
            {
                throw new PnrAnalysisFailException(pnrContent);
            }


            string   Msg        = "";
            PnrModel pnrMode    = null;
            PatModel patMode    = null;
            PatModel infPatMode = null;
            string   Pnr        = string.Empty;
            PnrAnalysis.Model.SplitPnrCon splitPnrCon = null;
            //PNR内容导入
            if (OrderParam == null)
            {
                splitPnrCon = format.GetSplitPnrCon(pnrContent);
                string RTCon  = splitPnrCon.RTCon;
                string PatCon = splitPnrCon.AdultPATCon != string.Empty ? splitPnrCon.AdultPATCon : splitPnrCon.ChdPATCon;

                if (string.IsNullOrEmpty(PatCon) || string.IsNullOrEmpty(RTCon) || !PatCon.Contains("PAT:A"))
                {
                    throw new PnrAnalysisFailException("RT和PAT内容不能为空!");
                }
                //去重复和备注
                string pnrRemark = string.Empty;
                RTCon = format.DelRepeatRTCon(RTCon, ref pnrRemark);
                if (!string.IsNullOrEmpty(pnrRemark))
                {
                    PatCon = PatCon.Replace(pnrRemark, "");
                }
                pnrContent = RTCon + "\r\n" + PatCon;
                Pnr        = format.GetPNR(RTCon, out Msg);
                if (string.IsNullOrEmpty(Pnr) || !format.IsPnr(Pnr))
                {
                    throw new PnrAnalysisFailException("PNR内容提取编码失败,请检查编码内容!");
                }

                pnrMode = format.GetPNRInfo(Pnr, RTCon, false, out Msg);
                if (pnrMode == null || pnrMode._LegList.Count == 0)
                {
                    throw new PnrAnalysisFailException("PNR内容解析航段信息失败,请检查编码内容");
                }

                //成人或者儿童PAT
                patMode = format.GetPATInfo(PatCon, out Msg);

                if (PnrImportType == EnumPnrImportType.PnrContentImport)
                {
                    if (pnrMode._PasType == "2")
                    {
                        throw new PnrAnalysisFailException("该编码【" + Pnr + "】为儿童编码,请选择“儿童编码”通道导入!");
                    }
                }
                else if (PnrImportType == EnumPnrImportType.GenericPnrImport)
                {
                    if (pnrMode._PasType == "2")
                    {
                        throw new PnrAnalysisFailException("该编码【" + Pnr + "】为儿童编码,请选择“儿童编码”通道导入!");
                    }
                }
            }
            else
            {
                PnrData pnrData = OrderParam.pnrData;
                if (pnrData == null)
                {
                    if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                    {
                        throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:预定内容有误!");
                    }
                    else
                    {
                        throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:PNR内容解析失败!");
                    }
                }
                //订座失败,请重新预定!失败原因:预定内容有误!
                //导入失败,请重新导入!失败原因:[PnrData]PNR内容解析失败,PnrData Fail!

                pnrMode    = pnrData.PnrMode;
                patMode    = pnrData.PatMode;
                infPatMode = pnrData.InfPatMode;
                Pnr        = order.OrderType == 0 ? pnrData.AdultPnr : pnrData.ChdPnr;

                if (pnrMode == null || pnrMode._LegList.Count == 0)
                {
                    if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                    {
                        throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:预定航段内容有误!");
                    }
                    else
                    {
                        throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:解析编码航段内容有误!");
                    }
                }

                //订座失败,请重新预定!失败原因:预定航段内容有误!
                //导入失败,请重新导入!失败原因:解析编码航段内容有误!
            }

            if (!pnrMode.PnrConIsOver)
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:预定内容有误!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:编码内容信息有误,RT编码内容需以Office号结尾,请检查编码内容!");
                }
            }

            //订座失败,请重新预定!失败原因:预定内容有误!
            //导入失败,请重新导入!失败原因:编码内容信息有误,RT编码内容需以Office号结尾,请检查编码内容!

            if (pnrMode.PnrStatus.Trim() == "")
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:解析出编码状态有误!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:解析出编码状态有误,请检查编码内容!");
                }
            }
            //订座失败,请重新预定!失败原因:解析出编码状态有误!
            //导入失败,请重新导入!失败原因:解析出编码状态有误,请检查编码内容


            if (pnrMode.PnrStatus.Contains("XX") ||
                pnrMode.PnrStatus.Contains("NO") ||
                pnrMode.PnrStatus.Contains("HL") ||
                pnrMode.PnrStatus.Contains("HN")
                )
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:编码状态有误,状态为:" + pnrMode.PnrStatus + "!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:编码状态有误,状态为XX,NO,HL,HN项不能导入!");
                }

                //订座失败,请重新预定!失败原因:编码状态有误,状态为:“+pnrMode.PnrStatus+”!
                //导入失败,请重新导入!失败原因:编码状态有误,状态为XX,NO,HL,HN项不能导入!
            }
            else if (!pnrMode.PassengerNameIsCorrent && pnrMode.ErrorPassengerNameList.Count > 0)//乘机人名字检查
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:乘机人名字(" + string.Join(",", pnrMode.ErrorPassengerNameList.ToArray()) + ")有误,请检查乘客姓名,生僻字用拼音代替!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:乘机人名字(" + string.Join(",", pnrMode.ErrorPassengerNameList.ToArray()) + ")有误,请检查乘客姓名,生僻字用拼音代替!");
                }
            }
            //订座失败,请重新预定!失败原因:乘机人名字(" + string.Join(",", pnrMode.ErrorPassengerNameList.ToArray()) + ")有误,请检查乘客姓名,生僻字用拼音代替!");
            //导入失败,请重新导入!失败原因:乘机人名字(" + string.Join(",", pnrMode.ErrorPassengerNameList.ToArray()) + ")有误,请检查乘客姓名,生僻字用拼音代替!");

            else if (!pnrMode.PnrConHasFirstNum)//乘客姓名序号是否已1开始
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:PNR内容中乘客姓名序号项不规范,请检查编码内容!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:PNR内容中乘客姓名序号项不规范,请检查编码内容!");
                }
            }
            //订座失败,请重新预定!失败原因:PNR内容中乘客姓名序号项不规范,请检查编码内容!
            //导入失败,请重新导入!失败原因:PNR内容中乘客姓名序号项不规范,请检查编码内容!


            //else if (string.IsNullOrEmpty(pnrMode._BigPnr))
            //    throw new PnrAnalysisFailException("编码[" + Pnr + "]PNR内容中没有大编码,请补齐大编码后导入!");
            //else if (pnrMode.HasExistNoSsr)
            //    throw new PnrAnalysisFailException("编码内容中乘客证件号不全,请补全证件号!");
            //else if (pnrMode.SsrIsRepeat)
            //    throw new PnrAnalysisFailException("编码内容中乘客证件号重复,请检查PNR内容证件号!");
            else if (pnrMode.TravelType > 3)
            {
                if (PnrImportType == EnumPnrImportType.WhiteScreenDestine)
                {
                    throw new PnrAnalysisFailException("订座失败,请重新预定!失败原因:系统暂不支持缺口程和多程航段!");
                }
                else
                {
                    throw new PnrAnalysisFailException("导入失败,请重新导入!失败原因:系统暂不支持缺口程和多程航段!");
                }
            }
            //订座失败,请重新预定!失败原因:系统暂不支持缺口程和多程航段!
            //导入失败,请重新导入!失败原因:系统暂不支持缺口程和多程航段!


            //JD导入 验证
            if (pnrMode._CarryCode.ToUpper().Contains("JD"))
            {
                bool JDIsPass = true;
                //编码中成人 儿童 婴儿 个数
                int adultNum = 0, childNum = 0, YNum = 0;
                foreach (PassengerInfo item in pnrMode._PassengerList)
                {
                    if (item.PassengerType == "1")
                    {
                        adultNum++;
                    }
                    if (item.PassengerType == "2")
                    {
                        childNum++;
                    }
                    if (item.PassengerType == "3")
                    {
                        YNum++;
                    }
                }
                bool b1 = adultNum == 1 && childNum == 0 && YNum == 0;
                bool b2 = adultNum == 0 && childNum == 1 && YNum == 0;
                bool b3 = adultNum == 1 && childNum == 1 && YNum == 0;
                bool b4 = adultNum == 1 && childNum == 1 && YNum == 1;
                bool b5 = adultNum == 1 && childNum == 0 && YNum == 1;
                if (!(b1 || b2 || b3 || b4 || b5))
                {
                    JDIsPass = false;
                }
                if (!JDIsPass)
                {
                    throw new PnrAnalysisFailException("JD航空编码【" + Pnr + "】中只能有一个成人,一个儿童,一个婴儿,请手动处理编码内容!");
                }
            }
            decimal TicketPrice = 0m, INFTicketPrice = 0m;
            decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
            decimal INFSeatPrice = 0m, INFTaxFare = 0m, INFRQFare = 0m;


            if (patMode == null || patMode.UninuePatList.Count == 0)
            {
                throw new PnrAnalysisFailException("PAT解析价格失败");
            }
            if (patMode.IsOverMaxPrice)
            {
                throw new PnrAnalysisFailException("PAT支付价格超出范围!");
            }
            //默认取低价
            PatInfo pat = order.IsLowPrice ? patMode.UninuePatList[0] : patMode.UninuePatList[patMode.UninuePatList.Count - 1];
            decimal.TryParse(pat.Price, out TicketPrice);
            decimal.TryParse(pat.Fare, out SeatPrice);
            decimal.TryParse(pat.TAX, out TaxFare);
            decimal.TryParse(pat.RQFare, out RQFare);
            if (SeatPrice <= 0)
            {
                throw new PnrAnalysisFailException("舱位价不能小于等于0");
            }
            if (TicketPrice <= 0)
            {
                throw new PnrAnalysisFailException("PAT总价不能小于等于0");
            }

            //PNR内容导入
            if (OrderParam == null)
            {
                if (pnrMode.HasINF && !string.IsNullOrEmpty(splitPnrCon.INFPATCon.Trim())) //如果有婴儿
                {
                    if (string.IsNullOrEmpty(splitPnrCon.INFPATCon) || !splitPnrCon.INFPATCon.Contains("PAT:A*IN"))
                    {
                        throw new PnrAnalysisFailException("编码中含有婴儿,为获取到婴儿的PAT价格信息!");
                    }

                    infPatMode = format.GetPATInfo(splitPnrCon.INFPATCon, out Msg);
                    if (infPatMode == null || infPatMode.UninuePatList.Count == 0)
                    {
                        throw new PnrAnalysisFailException("婴儿PAT解析价格失败");
                    }
                    //默认取低价
                    PatInfo patInf = order.IsLowPrice ? infPatMode.UninuePatList[0] : infPatMode.UninuePatList[infPatMode.UninuePatList.Count - 1];
                    decimal.TryParse(patInf.Price, out INFTicketPrice);
                    decimal.TryParse(patInf.Fare, out INFSeatPrice);
                    decimal.TryParse(patInf.TAX, out INFTaxFare);
                    decimal.TryParse(patInf.RQFare, out INFRQFare);
                    if (INFTicketPrice <= 0)
                    {
                        throw new PnrAnalysisFailException("婴儿舱位价不能小于等于0");
                    }
                    if (INFTicketPrice <= 0)
                    {
                        throw new PnrAnalysisFailException("婴儿PAT总价不能小于等于0");
                    }

                    pnrContent = pnrContent + "\r\n" + splitPnrCon.INFPATCon;
                }
            }
            else
            {
                if (pnrMode != null && pnrMode.HasINF && infPatMode != null) //如果有婴儿
                {
                    if (infPatMode == null || infPatMode.UninuePatList.Count == 0)
                    {
                        throw new PnrAnalysisFailException("婴儿PAT解析价格失败");
                    }
                    //默认取低价
                    PatInfo patInf = order.IsLowPrice ? infPatMode.UninuePatList[0] : infPatMode.UninuePatList[infPatMode.UninuePatList.Count - 1];
                    decimal.TryParse(patInf.Price, out INFTicketPrice);
                    decimal.TryParse(patInf.Fare, out INFSeatPrice);
                    decimal.TryParse(patInf.TAX, out INFTaxFare);
                    decimal.TryParse(patInf.RQFare, out INFRQFare);
                    if (INFTicketPrice <= 0)
                    {
                        throw new PnrAnalysisFailException("婴儿舱位价不能小于等于0");
                    }
                    if (INFTicketPrice <= 0)
                    {
                        throw new PnrAnalysisFailException("婴儿PAT总价不能小于等于0");
                    }
                }
            }

            if (TicketPrice <= 0)
            {
                throw new PnrAnalysisFailException("票面总价不能小于等于0");
            }

            #endregion

            //构造数据
            double FlyAdvanceTime = 1;// SettingSection.GetInstances().Cashbag.FlyAdvanceTime;
            double.TryParse(System.Configuration.ConfigurationManager.AppSettings["FlyAdvanceTime"].ToString(), out FlyAdvanceTime);
            order.PnrCode         = Pnr;
            order.BigCode         = pnrMode._BigPnr;
            order.OrderType       = pnrMode._PasType == "1" ? 0 : 1;
            order.PnrType         = pnrMode._PnrType == "1" ? 0 : 1;
            order.Remark          = "";
            order.TicketPrice     = TicketPrice;
            order.INFTicketPrice  = INFTicketPrice;
            order.BusinessmanCode = businessmanCode;
            order.BusinessmanName = businessmanName;
            order.CarrierCode     = CarrierCode;
            order.OperatorAccount = account;
            order.CreateTime      = DateTime.Now;
            order.PnrContent      = pnrContent;
            order.HasAfterSale    = false;
            order.YdOffice        = pnrMode._Office;
            decimal          defaultOrderMoney = 0m;
            bool             HaveBabyFlag      = false;
            List <SkyWay>    SkyWays           = new List <SkyWay>();
            List <Passenger> Passengers        = new List <Passenger>();
            if (OrderParam == null)
            {
                DateTime tempStartTime = System.DateTime.Now;
                string   Seat          = string.Empty;
                //内容导入
                foreach (var leg in pnrMode._LegList)
                {
                    Seat = leg.Seat;
                    //如果有子舱位就用子舱位
                    if (!string.IsNullOrEmpty(leg.ChildSeat) && leg.ChildSeat.Trim().Length == 2)
                    {
                        Seat = leg.ChildSeat.Trim();
                    }
                    SkyWays.Add(new SkyWay()
                    {
                        FromCityCode  = leg.FromCode,
                        ToCityCode    = leg.ToCode,
                        FlightNumber  = leg.FlightNum,
                        StartDateTime = DateTime.Parse(leg.FlyDate1 + " " + leg.FlyStartTime.Insert(2, ":") + ":00"),
                        ToDateTime    = DateTime.Parse(leg.FlyDateE + " " + leg.FlyEndTime.Insert(2, ":") + ":00"),
                        CarrayCode    = leg.AirCode,
                        Seat          = Seat,
                        FromTerminal  = getHZL(leg.FromCode, leg.AirCode, leg.FromCityT1),
                        ToTerminal    = getHZL(leg.ToCode, leg.AirCode, leg.ToCityT2),
                        Discount      = baseQuery.GetZK(leg.FromCode, leg.ToCode, leg.AirCode, leg.Seat, SeatPrice)
                    });
                }
                tempStartTime = SkyWays[0].StartDateTime.AddHours(-FlyAdvanceTime);
                if (DateTime.Compare(tempStartTime, System.DateTime.Now) <= 0)
                {
                    //起飞时间小于预定时间  已起飞 已失效 不能导入
                    throw new PnrAnalysisFailException("航班起飞前" + FlyAdvanceTime + "小时内不能导入编码内容!");
                }
                foreach (var pas in pnrMode._PassengerList)
                {
                    if (pas.PassengerType == "3")
                    {
                        Passengers.Add(new Passenger()
                        {
                            PassengerName = pas.PassengerName,
                            CardNo        = pas.SsrCardID,
                            SeatPrice     = INFSeatPrice,
                            ABFee         = INFTaxFare,
                            RQFee         = INFRQFare,
                            PassengerType = EnumPassengerType.Baby,
                            TicketStatus  = EnumTicketStatus.Unknown,
                            Mobile        = pas.PassengerTel,
                        });
                        defaultOrderMoney += INFSeatPrice + INFTaxFare + INFRQFare;
                        HaveBabyFlag       = true;
                    }
                    else
                    {
                        Passengers.Add(new Passenger()
                        {
                            PassengerName = pas.PassengerName,
                            CardNo        = pas.SsrCardID,
                            SeatPrice     = SeatPrice,
                            ABFee         = TaxFare,
                            RQFee         = RQFare,
                            PassengerType = (EnumPassengerType)pas.PassengerType.ToInt(),
                            TicketStatus  = EnumTicketStatus.Unknown,
                            Mobile        = pas.PassengerTel
                        });
                        defaultOrderMoney += SeatPrice + TaxFare + RQFare;
                    }
                }
            }
            else
            {
                //是否儿童订单
                bool IsChdOrder = false;
                foreach (PassengerDto pas in OrderParam.PassengerDtos)
                {
                    if (pas.PassengerType == EnumPassengerType.Baby)
                    {
                        Passengers.Add(new Passenger()
                        {
                            PassengerName = pas.PassengerName,
                            CardNo        = pas.CardNo,
                            SeatPrice     = INFSeatPrice,
                            ABFee         = INFTaxFare,
                            RQFee         = INFRQFare,
                            PassengerType = EnumPassengerType.Baby,
                            TicketStatus  = EnumTicketStatus.Unknown,
                            Mobile        = pas.Mobile,
                            IdType        = pas.IdType,
                            SexType       = pas.SexType,
                            Birth         = pas.Birth
                        });
                        defaultOrderMoney += INFSeatPrice + INFTaxFare + INFRQFare;
                        HaveBabyFlag       = true;
                    }
                    else
                    {
                        IsChdOrder = pas.PassengerType == EnumPassengerType.Child ? true : false;
                        Passengers.Add(new Passenger()
                        {
                            PassengerName = pas.PassengerName,
                            CardNo        = pas.CardNo,
                            SeatPrice     = SeatPrice,
                            ABFee         = TaxFare,
                            RQFee         = RQFare,
                            PassengerType = pas.PassengerType,
                            TicketStatus  = EnumTicketStatus.Unknown,
                            Mobile        = pas.Mobile,
                            IdType        = pas.IdType,
                            SexType       = pas.SexType,
                            Birth         = pas.Birth
                        });
                        defaultOrderMoney += SeatPrice + TaxFare + RQFare;
                    }
                }

                List <LegInfo> legInfo = pnrMode._LegList;
                //白屏预定
                int i = 0;
                foreach (SkyWayDto leg in OrderParam.SkyWayDtos)
                {
                    string strSeat = leg.Seat;
                    //处理儿童的舱位问题
                    if (IsChdOrder)
                    {
                        if (!"FCY".Contains(leg.Seat.ToUpper()))
                        {
                            if (legInfo[0].Seat.Trim().ToUpper() != leg.Seat.Trim().ToUpper())
                            {
                                strSeat = "Y";
                            }
                        }
                    }
                    else
                    {
                        //如果有子舱位就用子舱位
                        if (legInfo.Count > i && !string.IsNullOrEmpty(legInfo[i].ChildSeat) && legInfo[i].ChildSeat.Trim().Length == 2)
                        {
                            strSeat = legInfo[i].ChildSeat.Trim();
                        }
                    }
                    SkyWays.Add(new SkyWay()
                    {
                        FromCityCode  = leg.FromCityCode,
                        ToCityCode    = leg.ToCityCode,
                        FlightNumber  = leg.FlightNumber,
                        StartDateTime = leg.StartDateTime,
                        ToDateTime    = leg.ToDateTime,
                        CarrayCode    = leg.CarrayCode,
                        Seat          = strSeat,
                        FromTerminal  = leg.FromTerminal,
                        ToTerminal    = leg.ToTerminal,
                        Discount      = leg.Discount,
                        FlightModel   = leg.FlightModel
                    });
                    i++;
                }
            }
            order.SkyWays      = SkyWays;
            order.Passengers   = Passengers;
            order.OrderMoney   = defaultOrderMoney;
            order.HaveBabyFlag = HaveBabyFlag;
            //是否换编码出票
            order.IsChangePnrTicket = IsChangePnrTicket;
            //order.Policy = new Policy();
            order.OrderPay = new OrderPay()
            {
                PaidStatus = EnumPaidStatus.NoPaid,
                PayStatus  = EnumPayStatus.NoPay,
                OrderId    = order.OrderId
            };
            order.ChangeStatus(EnumOrderStatus.WaitChoosePolicy);
            //订单日志
            order.WriteLog(new OrderLog()
            {
                OperationDatetime = System.DateTime.Now,
                OperationPerson   = account,
                Remark            = "",
                OperationContent  = "生成订单",
                IsShowLog         = true
            });
            return(order);
        }
Пример #14
0
        //自动取消处理线程
        public static void XEPNRProcess()
        {
            string SendIns  = string.Empty;
            string RecvData = string.Empty;
            string Office   = string.Empty;
            string ErrMsg   = string.Empty;
            string Pnr      = string.Empty;
            string OrderId  = string.Empty;

            PnrAnalysis.FormatPNR pnrFormat = new FormatPNR();
            while (true)
            {
                try
                {
                    SendIns  = string.Empty;
                    RecvData = string.Empty;
                    Office   = string.Empty;
                    ErrMsg   = string.Empty;
                    Pnr      = string.Empty;
                    OrderId  = string.Empty;

                    //组织订单过滤条件
                    //订单来源:白屏预订PNR
                    string tmpSQL = " OrderSourceType=1 " +
                                    //订单状态:新订单,等待支付
                                    "and OrderStatusCode=1 " +
                                    //支付状态:未付
                                    "and PayStatus=0 " +
                                    //预订公司编号(归属的落地运营商编号范围)
                                    "and left(OwnerCpyNo,12) in (" + string.Join(",", m_XePNRInfo.CompanyNoList.ToArray()) + ") " +
                                    //预定时间超过设置取消时间值
                                    " and DateDiff(minute,CreateTime,getdate())>" + m_XePNRInfo.XEMinutes.ToString() +
                                    //3天内的预定订单
                                    " and DateDiff(day,CreateTime,getdate())<" + XePNR.m_XePNRInfo.day.ToString();

                    //取消订单表
                    List <Tb_Ticket_Order> list = Manage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { tmpSQL }) as List <Tb_Ticket_Order>;
                    //滤过的PNR
                    List <string> tempPntList = new List <string>();
                    for (int i = 0; i < list.Count; i++)
                    {
                        //停止服务,则退出处理
                        if (m_XePNRInfo.EndFlag || XeLog == null)
                        {
                            return;
                        }
                        Tb_Ticket_Order tmpTicketOrder = list[i];
                        ///控制权限
                        string KonZhiXT = GetGYParameters(tmpTicketOrder.OwnerCpyNo);
                        //是否关闭后台自动取消编码功能
                        if (KonZhiXT != null && KonZhiXT.Contains("|98|"))
                        {
                            continue;
                        }
                        #region 过滤掉已经处理的PNR
                        if (tempPntList.Contains("'" + tmpTicketOrder.PNR + "'"))
                        {
                            continue;
                        }
                        #endregion

                        #region 检查同一编码、同一预订公司下是否存在已付款的订单
                        //包括收银
                        string tmpSQL3 = "  PNR='" + tmpTicketOrder.PNR + "'"
                                         + " and CreateTime>='" + tmpTicketOrder.CreateTime.ToString("yyyy-MM-dd") + "' and ( (OrderStatusCode in(3,4) and  PayStatus=0)  or   PayStatus=1 or OrderStatusCode=4 )";
                        bool flag1 = (bool)Manage.CallMethod("Tb_Ticket_Order", "IsExist", null, new object[] { tmpSQL3 });
                        if (flag1)
                        {
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            //存在已经支付的订单,略过
                            //记录日志
                            Log.Record("XePnr.log", "订单号:" + tmpTicketOrder.OrderId + ",PNR编号:" + tmpTicketOrder.PNR + "存在已经付款订单,略过该PNR...");
                            continue;
                        }
                        #endregion 检查同一编码、同一预订公司下是否存在已付款的订单

                        #region 提取并检查PNR是否已经出票或RR状态,如果是则略过
                        string GYCpyNo = tmpTicketOrder.OwnerCpyNo;
                        if (GYCpyNo.Length >= 12)
                        {
                            GYCpyNo = GYCpyNo.Substring(0, 12);
                        }
                        List <Bd_Base_Parameters> baseParamList = Manage.CallMethod("Bd_Base_Parameters", "GetList", null, new Object[] { "CpyNo='" + GYCpyNo + "'" }) as List <Bd_Base_Parameters>;
                        ConfigParam config = Bd_Base_ParametersBLL.GetConfigParam(baseParamList);
                        if (config == null)
                        {
                            XeLog(1, string.Format("订单号{0},落地运营商未设置使用配置信息,请设置!", tmpTicketOrder.OrderId));
                            //移除该落地运营商 该落地运营商未设置配置参数
                            if (m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                            {
                                m_XePNRInfo.CompanyNoList.Remove("'" + GYCpyNo + "'");
                            }
                            continue;
                        }
                        OrderId = tmpTicketOrder.OrderId;
                        Office  = string.IsNullOrEmpty(tmpTicketOrder.Office) ? config.Office.Split('^')[0] : tmpTicketOrder.Office;
                        if (string.IsNullOrEmpty(Office))
                        {
                            XeLog(1, string.Format("订单号{0}中没有Office或者落地运营商没有设置Office,请检查!", OrderId));
                            //移除该落地运营商 该落地运营商未设置配置参数
                            if (m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                            {
                                m_XePNRInfo.CompanyNoList.Remove("'" + GYCpyNo + "'");
                            }
                            continue;
                        }
                        Pnr = tmpTicketOrder.PNR;
                        if (string.IsNullOrEmpty(tmpTicketOrder.PNR) || (tmpTicketOrder.PNR.Trim() == ""))
                        {
                            XeLog(1, string.Format("订单号{0}中没有PNR,更改为已取消订单!", OrderId));

                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }

                        Tb_SendInsData SendModel = new Tb_SendInsData();
                        ParamObject    PM        = new ParamObject();
                        PM.ServerIP   = config.WhiteScreenIP;
                        PM.ServerPort = int.Parse(config.WhiteScreenPort);
                        PM.Office     = Office;
                        //发送指令
                        SendIns = "RT" + Pnr;
                        PM.code = SendIns;
                        PM.IsPn = true;

                        SendModel.SendIns         = SendIns;             //发送指令
                        SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                        SendModel.SendTime        = System.DateTime.Now; //发送时间
                        SendModel.Office          = Office;
                        SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                        SendModel.UserAccount     = "扫描程序";
                        SendModel.CpyNo           = GYCpyNo;
                        //返回数据
                        RecvData           = SendNewPID.SendCommand(PM);
                        SendModel.RecvData = RecvData;
                        SendModel.RecvTime = System.DateTime.Now;
                        //记录指令到数据库
                        LogData(SendModel);

                        //指令日志
                        XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n订单号:{3}\r\n", Pnr, SendIns, RecvData, tmpTicketOrder.OrderId));
                        if (RecvData.Contains("授权"))
                        {
                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            XeLog(1, string.Format("订单号{0}中{1} {2},只取消订单不取消编码!", OrderId, Pnr, RecvData));
                            continue;
                        }
                        string PnrStatus = pnrFormat.GetPnrStatus(RecvData, out ErrMsg);
                        if (!PnrStatus.ToUpper().Contains("HK") && !PnrStatus.ToUpper().Contains("HL") && !PnrStatus.ToUpper().Contains("NO"))//(PnrStatus.Contains("RR") || PnrStatus.Contains("XX"))
                        {
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            XeLog(1, string.Format("订单号{0}中{1}状态为{2},只取消订单,不处理PNR!", OrderId, Pnr, PnrStatus));

                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }
                        #endregion 提取并检查PNR是否已经出票或RR状态,如果是则略过

                        #region 发送取消PNR指令并检查结果

                        if (PnrStatus.ToUpper().Contains("HK") || PnrStatus.ToUpper().Contains("HL") || PnrStatus.ToUpper().Contains("NO"))
                        {
                            //取消编码
                            SendIns = "RT" + Pnr + "|XEPNR@" + Pnr;
                            PM.code = SendIns;
                            PM.IsPn = false;

                            SendModel                 = new Tb_SendInsData();
                            SendModel.SendIns         = SendIns;             //发送指令
                            SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                            SendModel.SendTime        = System.DateTime.Now; //发送时间
                            SendModel.Office          = Office;
                            SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                            SendModel.UserAccount     = "扫描程序";
                            SendModel.CpyNo           = GYCpyNo;
                            //返回数据
                            RecvData           = SendNewPID.SendCommand(PM);
                            SendModel.RecvData = RecvData;
                            SendModel.RecvTime = System.DateTime.Now;
                            //记录指令到数据库
                            LogData(SendModel);

                            //指令日志
                            XeLog(1, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", OrderId, SendIns, RecvData));

                            if (RecvData.ToUpper().Contains("CANCELLED"))
                            {
                                //加入不需要取消的列表
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                                //取消编码成功后 取消订单
                                List <string> ListSQL = new List <string>();
                                //修改订单数据
                                string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                                ListSQL.Add(tempSql);//
                                //修改乘客数据
                                tempSql = "update Tb_Ticket_Passenger set TicketStatus=6  where OrderId='" + OrderId + "'";
                                ListSQL.Add(tempSql);//1.添加订单日志

                                //取消编码 订单日志
                                Log_Tb_AirOrder OrderLog = new Log_Tb_AirOrder();
                                OrderLog.id            = Guid.NewGuid();
                                OrderLog.OperContent   = "订单超过" + m_XePNRInfo.XEMinutes.ToString() + "分钟未能成功支付,系统于" + System.DateTime.Now + "订单自动取消";;
                                OrderLog.OperLoginName = "管理员";
                                OrderLog.OperTime      = DateTime.Now;
                                OrderLog.OperType      = "修改";
                                OrderLog.OperUserName  = "******";
                                OrderLog.OrderId       = OrderId;
                                OrderLog.WatchType     = 1;
                                //订单出票公司信息
                                ListParam TicketLP = LPList.Find(delegate(ListParam _tempLP)
                                {
                                    return(tmpTicketOrder.OwnerCpyNo.Contains(_tempLP.CpyNo));
                                });
                                if (TicketLP != null)
                                {
                                    OrderLog.CpyName = TicketLP.UninAllName;
                                    OrderLog.CpyNo   = TicketLP.CpyNo;
                                    OrderLog.CpyType = 1;
                                }
                                else
                                {
                                    OrderLog.CpyName = tmpTicketOrder.OwnerCpyName;
                                    OrderLog.CpyNo   = tmpTicketOrder.OwnerCpyNo;
                                    OrderLog.CpyType = 1;
                                }
                                tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Tb_AirOrder> .CreateInsertModelSql(OrderLog);

                                ListSQL.Add(tempSql);
                                //取消订单
                                if (Manage.ExecuteSqlTran(ListSQL, out ErrMsg))
                                {
                                    XeLog(1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 订单号:" + OrderId + " 订单已取消");
                                }
                            }
                        }
                        #endregion 发送取消PNR指令并检查结果
                    }

                    #region //修改滤过的PNR状态
                    if (tempPntList.Count > 0)
                    {
                        string sqlWhere = " update Log_Pnr set  Flag=1 where   Pnr in(" + string.Join(",", tempPntList.ToArray()) + ")";
                        Manage.ExecuteNonQuerySQLInfo(sqlWhere);
                    }

                    #endregion

                    #region    //生成了编码 没有生成订单的编码
                    string tmpSQL2 = " left(CpyNo,12) in (" + string.Join(",", m_XePNRInfo.CompanyNoList.ToArray()) + ") and DateDiff(minute,OperTime,getdate())>" + m_XePNRInfo.XEMinutes.ToString() + " and OrderFlag=0 and Flag=0 and RetryCount<" + m_XePNRInfo.ReTryCount;
                    //过滤掉没有连接成功的PNR
                    List <string> lstRepeat = new List <string>();
                    //取消PNR表 没有写入订单的数据
                    List <Log_Pnr> list2 = Manage.CallMethod("Log_Pnr", "GetList", null, new object[] { tmpSQL2 }) as List <Log_Pnr>;
                    for (int j = 0; j < list2.Count; j++)
                    {
                        //停止服务,则退出处理
                        if (m_XePNRInfo.EndFlag)
                        {
                            return;
                        }
                        Log_Pnr tmpLogPnr = list2[j];
                        ///控制权限
                        string KonZhiXT = GetGYParameters(tmpLogPnr.CpyNo);
                        //是否关闭后台自动取消编码功能
                        if (KonZhiXT != null && KonZhiXT.Contains("|98|"))
                        {
                            continue;
                        }
                        string GYCpyNo = tmpLogPnr.CpyNo.Length >= 12 ? tmpLogPnr.CpyNo.Substring(0, 12) : tmpLogPnr.CpyNo;
                        //勾选了该落地运营商的才取消编码
                        if (!m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                        {
                            continue;
                        }
                        //不取消滤过的PNR
                        if (tmpLogPnr.PNR != "" && tempPntList.Contains("'" + tmpLogPnr.PNR + "'"))
                        {
                            tmpLogPnr.Flag = true;
                            string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }

                        #region 取消PNR
                        string pnr = tmpLogPnr.PNR;
                        //pnr为空不处理  //Office为空不处理
                        if (string.IsNullOrEmpty(pnr) || string.IsNullOrEmpty(tmpLogPnr.OfficeCode))
                        {
                            tmpLogPnr.Flag = true;
                            string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }
                        ////IP端口为空不处理
                        string[] strIPPort = tmpLogPnr.A7.Split('|');
                        if (strIPPort.Length == 2)
                        {
                            if (pnr.Trim() == "")
                            {
                                tmpLogPnr.Flag = true;
                                string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                Manage.ExecuteNonQuerySQLInfo(tempSql);
                                continue;
                            }


                            string ip   = strIPPort[0];
                            int    Port = 0;
                            int.TryParse(strIPPort[1], out Port);

                            Tb_SendInsData SendModel = new Tb_SendInsData();
                            ParamObject    PM        = new ParamObject();
                            PM.ServerIP   = ip;
                            PM.ServerPort = Port;
                            PM.Office     = tmpLogPnr.OfficeCode;

                            //发送指令
                            SendIns = "RT" + pnr;
                            PM.code = SendIns;

                            SendModel.SendIns         = SendIns;             //发送指令
                            SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                            SendModel.SendTime        = System.DateTime.Now; //发送时间
                            SendModel.Office          = Office;
                            SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                            SendModel.UserAccount     = "扫描程序";
                            SendModel.CpyNo           = GYCpyNo;
                            //过滤连接不通的IP端口
                            if (lstRepeat.Contains(SendModel.ServerIPAndPort))
                            {
                                continue;
                            }
                            //返回数据
                            RecvData           = SendNewPID.SendCommand(PM);
                            SendModel.RecvData = RecvData;
                            SendModel.RecvTime = System.DateTime.Now;
                            //记录指令到数据库
                            LogData(SendModel);
                            //过滤连接不通的IP端口
                            if (RecvData.Contains("由于连接方在一段时间后没有正确答复或连接的主机没有反应") || RecvData.Contains("不知道这样的主机"))
                            {
                                lstRepeat.Add(SendModel.ServerIPAndPort);
                            }
                            //指令日志
                            XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Pnr, SendIns, RecvData));
                            string PnrStatus = pnrFormat.GetPnrStatus(RecvData, out ErrMsg);
                            if (!PnrStatus.Contains("RR") && !PnrStatus.Contains("XX") && PnrStatus != "")
                            {
                                if (PnrStatus.ToUpper().Contains("HK") || PnrStatus.ToUpper().Contains("HL") || PnrStatus.ToUpper().Contains("NO"))
                                {
                                    //发送指令
                                    SendIns = "RT" + pnr + "|XePNR@" + pnr;
                                    PM.code = SendIns;

                                    SendModel                 = new Tb_SendInsData();
                                    SendModel.SendIns         = SendIns;             //发送指令
                                    SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                                    SendModel.SendTime        = System.DateTime.Now; //发送时间
                                    SendModel.Office          = Office;
                                    SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                                    SendModel.UserAccount     = "扫描程序";
                                    SendModel.CpyNo           = GYCpyNo;
                                    //返回数据
                                    RecvData           = SendNewPID.SendCommand(PM);
                                    SendModel.RecvData = RecvData;
                                    SendModel.RecvTime = System.DateTime.Now;
                                    //记录指令到数据库
                                    LogData(SendModel);

                                    //指令日志
                                    XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", pnr, SendIns, RecvData));
                                    if (RecvData.ToUpper().Contains("CANCELLED"))
                                    {
                                        //取消成功
                                        tmpLogPnr.Flag = true;
                                    }
                                    else
                                    {
                                        //取消失败
                                        tmpLogPnr.Flag = false;
                                        tmpLogPnr.RetryCount++;
                                    }
                                    string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                    Manage.ExecuteNonQuerySQLInfo(tempSql);
                                }
                            }
                            else
                            {
                                tmpLogPnr.Flag = true;
                                string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                Manage.ExecuteNonQuerySQLInfo(tempSql);
                            }
                        }
                        #endregion
                    }
                    //更新数据库
                    //if (UpdateSQL.Count > 0)
                    //{
                    //    Manage.ExecuteSqlTran(UpdateSQL, out ErrMsg);
                    //}
                    #endregion
                }
                catch (Exception ex)
                {
                    //记录错误日志
                    Log.Record("XePnrError.log", ex, "XEPNRProcess:自动取消PNR处理过程出错!");
                }
                //遍历时间间隔
                Thread.Sleep(m_XePNRInfo.InterMinutes * 1000);//分钟
            }
        }