コード例 #1
0
        /// <summary>
        /// 生成编码
        /// </summary>
        /// <param name="CarryCode">航空公司二字码</param>
        /// <param name="Office">预订编码Office</param>
        /// <param name="AdultPnr">儿童订单中儿童编码备注的成人编码</param>
        /// <param name="IsChdETDZAudltTK">是否儿童出成人票</param>
        /// <param name="pList">乘机人列表</param>
        /// <param name="skywaylist">航段列表</param>
        /// <returns></returns>
        public RePnrObj GetPnrInfo(string CarryCode, List <Tb_Ticket_Passenger> pList, List <Tb_Ticket_SkyWay> skywaylist, out string ErrMsg)
        {
            ErrMsg = "";
            List <IPassenger> pasList  = new List <IPassenger>();
            List <ISkyLeg>    skyList  = new List <ISkyLeg>();
            SendNewPID        pid      = new SendNewPID();
            PnrParamObj       PnrParam = new PnrParamObj();

            //必填项 是否开启新版PID发送指令
            PnrParam.UsePIDChannel     = userInfo.FQP.KongZhiXiTong != null && userInfo.FQP.KongZhiXiTong.Contains("|48|") ? 2 : 0; //2;
            PnrParam.ServerIP          = userInfo.Configparam.WhiteScreenIP;
            PnrParam.ServerPort        = int.Parse(string.IsNullOrEmpty(userInfo.Configparam.WhiteScreenPort) ? "0" : userInfo.Configparam.WhiteScreenPort);
            PnrParam.Office            = userInfo.Configparam.Office.Split('^')[0];
            PnrParam.CarryCode         = CarryCode;
            PnrParam.PasList           = pasList;
            PnrParam.SkyList           = skyList;
            PnrParam.IsGetSpecialPrice = 1;//为获取特价
            //是否儿童出成人票
            PnrParam.ChildIsAdultEtdz = "0";
            //可选项
            PnrParam.UserName = userInfo.User != null ? userInfo.User.LoginName : "";

            //输入的手机号码 预订编码CT项电话
            PnrParam.CTTel     = "028-55555555";
            PnrParam.CTCTPhone = "15928636274";


            PnrParam.PID   = userInfo.Configparam.Pid;
            PnrParam.KeyNo = userInfo.Configparam.KeyNo;
            //乘机人
            foreach (Tb_Ticket_Passenger pas in pList)
            {
                IPassenger p1 = new IPassenger();
                pasList.Add(p1);
                p1.PassengerName = pas.PassengerName;
                p1.PassengerType = pas.PassengerType;
                p1.PasSsrCardID  = pas.Cid;
            }
            //航段
            foreach (Tb_Ticket_SkyWay skyway in skywaylist)
            {
                ISkyLeg leg1 = new ISkyLeg();
                skyList.Add(leg1);
                leg1.CarryCode    = skyway.CarryCode;
                leg1.FlightCode   = skyway.FlightCode;
                leg1.FlyStartTime = skyway.FromDate.ToString("HHmm");
                leg1.FlyEndTime   = skyway.ToDate.ToString("HHmm");
                leg1.FlyStartDate = skyway.FromDate.ToString("yyyy-MM-dd");
                leg1.fromCode     = skyway.FromCityCode;
                leg1.toCode       = skyway.ToCityCode;
                leg1.Space        = skyway.Space;
                leg1.Discount     = skyway.Discount;
            }
            RePnrObj pObj = pid.ISendIns(PnrParam);

            //记录指令
            SaveInsInfo(pObj, userInfo.User, userInfo.Company);
            return(pObj);
        }
コード例 #2
0
        /// <summary>
        /// 创建PNR时 生成一个没有政策的订单信息
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="parames"></param>
        public override void Create(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            List <Tb_Ticket_Passenger> pList      = new List <Tb_Ticket_Passenger>();
            List <Tb_Ticket_SkyWay>    skywaylist = new List <Tb_Ticket_SkyWay>();

            #region 取提交的参数信息

            string adultPnr      = parames["adultPnr"];                         //只是儿童时需要备注的成人编码
            string pListStr      = parames["pList"];                            //乘机人信息 名称,类型,证件ID,儿童生日/名称,类型,证件ID,儿童生日
            string skywaylistStr = parames["skywaylist"];                       //航段信息 承运人,航班号,起飞日期,到达日期,起飞三字码,到达三字码,起飞城市,到达城市,舱位,折扣/航段信息 承运人,航班号,起飞日期,到达日期,起飞三字码,到达三字码,起飞城市,到达城市,舱位,折扣
            allowChangePNRFlag         = parames["allowChangePNRFlag"] == "1";  //是否允许换编码出票
            isAsAdultOrder             = parames["isAsAdultOrder"] == "1";      //是否关联成人订单号
            cHDAssociationAdultOrderId = parames["cHDAssociationAdultOrderId"]; //关联成人定单号
            isCHDToAudltTK             = parames["isCHDToAudltTK"] == "1";      //儿童票出成人票
            linkMan      = parames["linkMan"];                                  //联系人
            linkManPhone = parames["linkManPhone"];                             //联系人电话
            travelType   = parames["travelType"];                               //航班类型  1=单程,2=往返,3=中转联程 4=多程
            foreach (var pStr in pListStr.Split('/'))
            {
                var ps = pStr.Split(',');
                if (ps[1] == "2" && ps.Count() == 4)
                {
                    pList.Add(new Tb_Ticket_Passenger()
                    {
                        PassengerName = ps[0],
                        PassengerType = int.Parse(ps[1]),
                        Cid           = ps[2],
                        A7            = ps[3]
                    });
                }
                else if (ps[1] != "2")
                {
                    pList.Add(new Tb_Ticket_Passenger()
                    {
                        PassengerName = ps[0],
                        PassengerType = int.Parse(ps[1]),
                        Cid           = ps[2]
                    });
                }

                else
                {
                    writer.WriteEx(550, "passenger format error", "乘机人格式有误");
                }
            }
            foreach (var kStr in skywaylistStr.Split('/'))
            {
                var ks = kStr.Split(',');
                if (ks.Count() == 10)
                {
                    skywaylist.Add(new Tb_Ticket_SkyWay()
                    {
                        CarryCode    = ks[0],
                        FlightCode   = ks[1],
                        FromDate     = DateTime.Parse(ks[2]),
                        ToDate       = DateTime.Parse(ks[3]),
                        FromCityCode = ks[4],
                        ToCityCode   = ks[5],
                        FromCityName = ks[6],
                        ToCityName   = ks[7],
                        Space        = ks[8],
                        Discount     = ks[9]
                    });
                }
                else
                {
                    writer.WriteEx(550, "skyway format error", "航段格式有误");
                }
            }
            #endregion

            UserLoginInfo     userLogin = AuthLogin.GetUserInfo(Username);
            List <IPassenger> pasList   = new List <IPassenger>();
            List <ISkyLeg>    skyList   = new List <ISkyLeg>();
            SendNewPID        pid       = new SendNewPID();
            PnrParamObj       PnrParam  = new PnrParamObj();
            //必填项 是否开启新版PID发送指令
            PnrParam.UsePIDChannel = userLogin.FQP.KongZhiXiTong != null && userLogin.FQP.KongZhiXiTong.Contains("|48|") ? 2 : 0;  //2;
            PnrParam.ServerIP      = userLogin.Configparam.WhiteScreenIP;
            PnrParam.ServerPort    = int.Parse(string.IsNullOrEmpty(userLogin.Configparam.WhiteScreenPort) ? "0" : userLogin.Configparam.WhiteScreenPort);
            PnrParam.Office        = userLogin.Configparam.Office;
            PnrParam.CarryCode     = skywaylist[0].CarryCode;
            PnrParam.PasList       = pasList;
            PnrParam.SkyList       = skyList;
            //只是儿童时需要备注的成人编码
            PnrParam.AdultPnr = adultPnr;
            //是否儿童出成人票
            PnrParam.ChildIsAdultEtdz = isCHDToAudltTK ? "1" : "0";;
            //可选项
            PnrParam.UserName = Username;



            //输入的手机号码 预订编码CT项电话
            if (userLogin.FQP.KongZhiXiTong == null || !userLogin.FQP.KongZhiXiTong.Contains("|19|"))
            {
                PnrParam.CTTel     = userLogin.User != null ? userLogin.User.Tel : "";
                PnrParam.CTCTPhone = linkManPhone != "" ? linkManPhone : (userLogin.Company != null && userLogin.Company.ContactTel.Trim() != "" ? userLogin.Company.ContactTel.Trim() : "");
            }
            else
            {
                PnrParam.CTTel     = userLogin.mSupCompany.Tel != null ? userLogin.mSupCompany.Tel : "";
                PnrParam.CTCTPhone = linkManPhone != "" ? linkManPhone : (userLogin.mSupCompany != null && userLogin.mSupCompany.ContactTel.Trim() != "" ? userLogin.mSupCompany.ContactTel.Trim() : "");
            }

            //关闭生成订单联系人默认值   生成订单时,联系人不需要默认值,让用户自己填写
            if (userLogin.FQP.KongZhiXiTong != null && userLogin.FQP.KongZhiXiTong.Contains("|55|"))
            {
                PnrParam.CTTel     = userLogin.User != null ? userLogin.User.Tel : "";
                PnrParam.CTCTPhone = linkManPhone;
            }


            PnrParam.PID   = userLogin.Configparam.Pid;
            PnrParam.KeyNo = userLogin.Configparam.KeyNo;
            //乘机人
            foreach (Tb_Ticket_Passenger pas in pList)
            {
                IPassenger p1 = new IPassenger();
                pasList.Add(p1);
                p1.PassengerName = pas.PassengerName;
                p1.PassengerType = pas.PassengerType;
                p1.PasSsrCardID  = pas.Cid;
                p1.ChdBirthday   = pas.A7;
            }
            //航段
            foreach (Tb_Ticket_SkyWay skyway in skywaylist)
            {
                ISkyLeg leg1 = new ISkyLeg();
                skyList.Add(leg1);
                leg1.CarryCode    = skyway.CarryCode;
                leg1.FlightCode   = skyway.FlightCode;
                leg1.FlyStartTime = skyway.FromDate.ToString("HHmm");
                leg1.FlyEndTime   = skyway.ToDate.ToString("HHmm");
                leg1.FlyStartDate = skyway.FromDate.ToString("yyyy-MM-dd");
                leg1.fromCode     = skyway.FromCityCode;
                leg1.toCode       = skyway.ToCityCode;
                leg1.Space        = skyway.Space;
                leg1.Discount     = skyway.Discount;
            }
            RePnrObj pObj = pid.ISendIns(PnrParam);
            string   msg  = "";
            if (GenerationOrder(userLogin, skywaylist, pList, pObj, out msg))
            {
                writer.Write(new { pnr = pObj, orderID = msg });
            }
            else
            {
                writer.WriteEx(565, "create order error", "创建空白定单失败:" + msg);
            }
        }