/// <summary>
    /// 拒绝改签
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUnOk_Click(object sender, EventArgs e)
    {
        bool result = false;

        try
        {
            Tb_Ticket_Order            Order         = ViewState["Order"] as Tb_Ticket_Order;
            List <Tb_Ticket_Passenger> PassengerList = ViewState["Passenger"] as List <Tb_Ticket_Passenger>;

            Order.OrderStatusCode = 23; //拒绝改签,退款中

            //流程: 1 修改状态 、2 退款
            //1.修改状态
            result = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().OperOrderGQ(Order, PassengerList, mUser, mCompany);

            string msg = "";

            //2.退款
            new PbProject.Logic.Pay.OperOnline().TitckOrderRefund(Order, mUser, mCompany, out msg);
        }
        catch
        {
        }
        if (result)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialogOne('拒绝改签,退款中!','" + ViewState["Url"].ToString() + "');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('拒绝改签,失败!');", true);
        }
    }
Beispiel #2
0
        /// <summary>
        /// 获取时间(处理时间)
        /// </summary>
        /// <param name="Order"></param>
        /// <returns></returns>
        private string[] GetTime(Tb_Ticket_Order Order)
        {
            string[] time = new string[2];
            time[0] = "";
            time[1] = "";

            try
            {
                if (Order.PolicySource > 2)
                {
                    //接口
                    if (!string.IsNullOrEmpty(Order.PolicyCancelTime))
                    {
                        time[0] = Order.PolicyCancelTime;
                        time[1] = Order.PolicyCancelTime;
                    }
                }
                if (string.IsNullOrEmpty(time[0]))
                {
                    string sqlWhere = "UninCode='" + Order.CPCpyNo + "'"; //出票方工作时间
                    PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage();
                    List <User_Company> User_CompanyList = baseDataManage.CallMethod("User_Company", "GetList", null, new Object[] { sqlWhere }) as List <User_Company>;

                    if (User_CompanyList != null && User_CompanyList.Count > 0)
                    {
                        time[0] = User_CompanyList[0].WorkTime;
                        time[1] = User_CompanyList[0].BusinessTime;
                    }
                }
            }
            catch (Exception)
            {
            }
            return(time);
        }
Beispiel #3
0
    /// <summary>
    /// repList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();

            string          Id    = e.CommandArgument.ToString();
            Tb_Ticket_Order Order = orderBll.GetTicketOrderById(Id);

            if (e.CommandName == "Detail")    //订单详情
            {
                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "location.href='OrderDetail.aspx?Id=" + Id + "&Url=TGQList.aspx&currentuserid=" + this.currentuserid.Value.ToString() + "';", true);
                //Response.Redirect("OrderDetail.aspx?Id=" + Id + "&Url=TGQList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "Process") //退改签处理
            {
                //if (!string.IsNullOrEmpty(Order.LockLoginName) && Order.LockLoginName != mUser.LoginName)
                //{
                //    //订单锁定 并且 非登录本账号锁定
                //    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('订单已锁,不能退改签申请!')", true);
                //}
                //else
                //{
                //    orderBll.LockOrder(true, Id, mUser, mCompany);
                Response.Redirect("TGQApplication.aspx?Id=" + Id + "&Url=TGQList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
                //}
            }
            else if (e.CommandName == "Pay") //改签支付
            {
                Response.Redirect("../Buy/Payment.aspx?Id=" + Id + "&Url=OperationingOrderList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "PayNo") //拒绝补差
            {
                string msg = "";

                Order.OrderStatusCode = 18;
                //orderBll.OperOrderGQ(Order, mUser, mCompany);
                string sqlWhere = " OrderId='" + Order.OrderId + "' ";
                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                bool reuslt = orderBll.OperOrderGQ(Order, PassengerList, mUser, mCompany);
                if (reuslt)
                {
                    PageDataBind();
                    msg = "拒绝补差成功";
                }
                else
                {
                    msg = "拒绝补差失败";
                }

                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "')", true);
            }
        }
        catch (Exception)
        {
        }
    }
Beispiel #4
0
        /// <summary>
        /// 获取航段信息
        /// </summary>
        /// <returns></returns>
        private List <HashObject> GetSkyInfo(Tb_Ticket_Order Order, List <Tb_Ticket_SkyWay> listsky, string skyStr)
        {
            List <HashObject> list = new List <HashObject>();
            string            IsFP = "1";

            if (Order != null && listsky != null && listsky.Count > 0)
            {
                string TravelCode = Order.TravelCode.Split('/')[0];
                string Travel     = Order.Travel.Split('/')[0];
                string fromcode   = TravelCode.Split('-')[0];
                string tocode     = TravelCode.Split('-')[1];
                string FromCity   = Travel.Split('-')[0];
                string ToCity     = Travel.Split('-')[1];
                string FromDate   = "";
                //查找第一程航段
                Tb_Ticket_SkyWay sky = listsky.Find(delegate(Tb_Ticket_SkyWay _sky)
                {
                    return((_sky.FromCityCode.ToUpper() == fromcode.ToUpper() || _sky.FromCityName == FromCity) && (_sky.ToCityCode.ToUpper() == tocode.ToUpper() || _sky.ToCityName == ToCity));
                });
                if (sky != null)
                {
                    FromDate = sky.FromDate.ToString("yyyy-MM-dd HH:mm:ss");
                    //坐了飞机以后还能提交退票 增加一个废票的限制,飞机起飞两个半小时内不能提交废票操作,只能走退票通道 1能提交废票 0不能提交废票
                    double Minutes = (sky.FromDate - System.DateTime.Now).TotalMinutes;
                    IsFP = Minutes < 150 ? "0" : "1";
                }
            }
            HashObject parameter = null;

            //航段信息
            string[] strArr = skyStr.Split('^');
            foreach (string PasModel in strArr)
            {
                parameter = new HashObject();
                string[] _strArr = PasModel.Split(new string[] { "@@@@" }, StringSplitOptions.None);
                if (_strArr != null && _strArr.Length == 10)
                {
                    parameter.Add("SkyId", _strArr[0]);
                    parameter.Add("FromCityName", _strArr[1]);
                    parameter.Add("ToCityName", _strArr[2]);
                    parameter.Add("FromCityCode", _strArr[3]);
                    parameter.Add("ToCityCode", _strArr[4]);
                    parameter.Add("FromDate", _strArr[5]);
                    parameter.Add("ToDate", _strArr[6]);
                    parameter.Add("CarryCode", _strArr[7]);
                    parameter.Add("FlightCode", _strArr[8]);
                    parameter.Add("Space", _strArr[9]);
                    parameter.Add("IsFP", IsFP);//是否可以废票
                    list.Add(parameter);
                }
            }
            return(list);
        }
        //查询实时政策 http://ip/api/policy?orderId=...
        public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            UserLoginInfo user = AuthLogin.GetUserInfo(Username);

            PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage();
            string orderId = parames["orderId"];
            List <Tb_Ticket_Order> reList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { string.Format("orderID='{0}'", orderId) }) as List <Tb_Ticket_Order>;

            if (reList == null && reList.Count == 0)
            {
                writer.WriteEx(541, "Can't Found Order by OrderID", "通过OrderID找不到订单信息");
            }
            else
            {
                Tb_Ticket_Order order = reList[0];
                PolicyMatch     pm    = new PolicyMatch();
                Regex           reg   = new Regex(@"(\w{3})-(\w{3})(/\2-(\w{3}))?");
                if (reg.IsMatch(order.TravelCode))
                {
                    var ma    = reg.Match(order.TravelCode);
                    var fcity = ma.Groups[1].Value;
                    var mcity = ma.Groups[3].Success ? ma.Groups[2].Value : "";
                    var tcity = ma.Groups[3].Success ? ma.Groups[4].Value : ma.Groups[2].Value;

                    OrderInputParam    InputParam = new OrderInputParam();
                    string             ErrMsg     = "";
                    Tb_Ticket_OrderBLL orderBLL   = new Tb_Ticket_OrderBLL();
                    InputParam = orderBLL.GetOrder(orderId, InputParam, out ErrMsg);
                    PbProject.Logic.Buy.AirQurey airqurey = new PbProject.Logic.Buy.AirQurey(user.BaseParametersList, user.User, user.Company);
                    var catchID = airqurey.SkyListSaveCache(InputParam, "0");//PNR导入不能确定舱位是否是特价舱位,暂时默认写死为普通 YYY 2013-05-22
                    var swList  = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { string.Format("orderID='{0}'", orderId) }) as List <Tb_Ticket_SkyWay>;

                    if (swList == null && swList.Count == 0)
                    {
                        writer.WriteEx(541, "Can't Found Ticket_SkyWay by OrderID", "通过OrderID找不到航程信息");
                    }
                    swList = swList.OrderBy(p => p.FromDate).ToList();


                    var policy = pm.getMatchingPolicy(user.Company.UninCode, fcity, mcity, tcity, swList[0].FromDate.ToString(), swList.Count > 1 ? swList[1].FromDate.ToString() : swList[0].ToDate.ToString(), order.TravelType.ToString(), catchID, false, user.Company.GroupId, orderId, user.User, order.IsChdFlag, order.HaveBabyFlag, false);

                    var lst = dataSetToList(policy, true);



                    writer.Write(lst);
                }
                else
                {
                    writer.WriteEx(541, "Error:TravelCode's format have error", "航班Code格式错误");
                }
            }
        }
    /// <summary>
    /// 返回 解锁
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        try
        {
            Tb_Ticket_Order mOrder = ViewState["Order"] as Tb_Ticket_Order;

            new PbProject.Logic.Order.Tb_Ticket_OrderBLL().LockOrder(false, mOrder.id.ToString(), mUser, mCompany);

            if (ViewState["Url"] != null)
            {
                Response.Redirect(ViewState["Url"].ToString());
            }
        }
        catch (Exception ex)
        {
        }
    }
    /// <summary>
    /// repCabinList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repOrderList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            string Id = e.CommandArgument.ToString();

            //订单收银
            if (e.CommandName == "Cashier")
            {
                string msg = "";

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = null; //订单

                if (mOrderList != null && mOrderList.Count > 0)
                {
                    Order = mOrderList[0];

                    if (Order.PayStatus == 0)
                    {
                        bool reuslt = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().OperOrderCashier(Order, mUser, mCompany);

                        if (reuslt)
                        {
                            msg = "订单收银成功!";
                            OrderListDataBind();
                        }
                        else
                        {
                            msg = "订单收银失败";
                        }
                    }

                    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
                }
            }
            else if (e.CommandName == "Detail")
            {
                //订单详情
                Response.Redirect("OrderDetail.aspx?Id=" + Id + "&Url=OrderList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
        }
        catch (Exception)
        {
        }
    }
Beispiel #8
0
 /// <summary>
 /// 账户余额支付
 /// </summary>
 /// <param name="mOrder">订单mOrder</param>
 /// <param name="mUser">当前操作员model</param>
 /// <param name="messge">消息</param> 
 public bool DepositPay(Tb_Ticket_Order mOrder, User_Employees mUser, out string messge)
 {
     lock (lockobject)
     {
         bool result = false;
         messge = "";
         try
         {
             result = new Bill().CreateVirtualPayBill(mOrder, mUser, out messge);
         }
         catch (Exception)
         {
             messge = "支付异常!";
         }
         return result;
     }
 }
Beispiel #9
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button2_Click(object sender, EventArgs e)
    {
        Tb_Ticket_OrderBLL OrderBLL = new Tb_Ticket_OrderBLL();

        Bill            data   = new Bill();
        Tb_Ticket_Order mOrder = new Tb_Ticket_Order();

        mOrder.OrderId    = "012122411355690062";             //订单编号
        mOrder.PayWay     = 1;                                //支付方式(见字典表)
        mOrder.OwnerCpyNo = "000001000002000003000004000005"; //订单方
        mOrder.CPCpyNo    = "000001000002";                   //出票方
        mOrder.PayMoney   = 2422;                             //交易金额(应收应付)
        mOrder.PayMoney   = 2422;                             //实际交易金额(实收实付)
        mOrder.InPayNo    = "634919457786718750";             //内部流水号

        mOrder.DiscountDetail = "000001000002000003000004^0.02^-3|000001000002000003^0.03^-5|000001000002^0.01^10";

        data.UpdateOrderAndTicketPayDetail(mOrder);
    }
Beispiel #10
0
        /// <summary>
        /// 退款查询
        /// </summary>
        /// <param name="mOrder"></param>
        /// <returns></returns>
        public string RefundSel(Tb_Ticket_Order mOrder, out string msgShow)
        {
            string returnValue = "";

            msgShow = "";

            try
            {
                string payType    = mOrder.PayWay.ToString();
                string oldOrderId = string.IsNullOrEmpty(mOrder.OldOrderId) ? mOrder.OrderId : mOrder.OldOrderId;
                string newOrderId = mOrder.OrderId;

                string onlineNo = mOrder.PayNo;

                returnValue = RefundSel(payType, oldOrderId, newOrderId, onlineNo, out msgShow);
            }
            catch (Exception ex)
            {
            }
            return(returnValue);
        }
Beispiel #11
0
        /// <summary>
        /// 取票
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="parames"></param>
        public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            string json;

            PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
            string sqlWhere = " OrderId='" + CommonMethod.GetFomartString(parames["OrderID"]) + "' ";

            List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>;
            Tb_Ticket_Order        Order     = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null;

            if (Order == null)
            {
                writer.WriteEx(546, "order num err", "订单编号错误");
            }
            else
            {
                sqlWhere = " OrderId='" + Order.OrderId + "' ";
                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                json = ListToJSon(PassengerList, Order.OrderId);
                writer.Write(json);
            }
        }
Beispiel #12
0
        /// <summary>
        /// 订单接口支付金额:
        /// </summary>
        /// <param name="mOrder">订单 mOrder :订单最终返点、订单扣点明细</param>
        /// <param name="mPassengers">乘机人 mOrder:舱位价、基建、燃油</param>
        public decimal CreateOrderIntfacePrice(Tb_Ticket_Order mOrder, List <Model.Tb_Ticket_Passenger> mPassengers)
        {
            decimal orderPayFee = 0; //订单支付金额

            try
            {
                decimal returnPoint   = mOrder.OldPolicyPoint; //接口原始政策
                decimal XianFanPayFee = 0;                     //现返 接口不计算

                if (mOrder != null && mPassengers != null && mPassengers.Count > 0)
                {
                    foreach (Tb_Ticket_Passenger item in mPassengers)
                    {
                        orderPayFee += CreatePayFeeIntfacePrice(item.PMFee, item.ABFee, item.FuelFee, returnPoint, XianFanPayFee, item.PassengerType);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(orderPayFee);
        }
Beispiel #13
0
        /// <summary>
        /// 获取乘机人信息
        /// </summary>
        /// <returns></returns>
        public List <HashObject> GetPassengerInfo(Tb_Ticket_Order Order, List <Tb_Ticket_Passenger> PassengerList, string passIDList)
        {
            List <HashObject> list = new List <HashObject>();

            try
            {
                HashObject parameter = null;
                string[]   strArr    = passIDList.Split(',');

                foreach (Tb_Ticket_Passenger passenger in PassengerList)
                {
                    parameter = new HashObject();
                    parameter.Add("IsChecked", "0");//是否选中1是0否
                    foreach (string pasModel in strArr)
                    {
                        if (pasModel.Trim().Equals(passenger.id.ToString()))
                        {
                            parameter["IsChecked"] = "1";//是否选中1是0否
                            break;
                        }
                    }
                    parameter.Add("id", passenger.id);
                    parameter.Add("pasName", passenger.PassengerName);
                    parameter.Add("pasPType", passenger.PassengerType);
                    parameter.Add("pasCType", passenger.CType);
                    parameter.Add("pasCid", passenger.Cid);
                    parameter.Add("pasTravelNumber", passenger.TravelNumber);
                    parameter.Add("pasTicketNum", passenger.TicketNumber);
                    parameter.Add("pasIsBack", passenger.IsBack);
                    parameter.Add("office", Order.Office);
                    list.Add(parameter);
                }
            }
            catch (Exception)
            {
            }
            return(list);
        }
Beispiel #14
0
        /// <summary>
        /// 账户余额退款
        /// </summary>
        /// <param name="mOrder">订单mOrder<</param>
        /// <param name="mUser">当前操作员model</param>
        /// <param name="mCompany">当前操作员公司model</param>
        /// <param name="Page">当前页面对象</param>
        /// <param name="messge">消息</param>
        /// <returns></returns>
        public bool DepositRefund(Tb_Ticket_Order mOrder, User_Employees mUser, User_Company mCompany, out string messge)
        {
            lock (lockobject)
            {
                bool result = false;
                messge = "";
                try
                {
                    result = new Bill().CreateVirtualRefundBill(mOrder, mUser, mCompany, out messge);

                    if (!result)
                    {
                        //退款失败记录日志
                        new Bill().CreateBillRefundFailedLog(mUser,mOrder.OrderId, messge);
                    }
                }
                catch (Exception)
                {
                    messge = "退款异常!";
                }
                return result;
            }
        }
    /// <summary>
    /// 页面信息绑定
    /// </summary>
    private void PageDataBind()
    {
        Tb_Ticket_Order        mOrder    = null;
        string                 sqlWhere  = string.Format("id='{0}'", ViewState["Id"].ToString());
        List <Tb_Ticket_Order> OrderList = this.baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { sqlWhere }) as List <Tb_Ticket_Order>;

        if (OrderList != null && OrderList.Count > 0)
        {
            mOrder = OrderList[0];
            string OrderId = mOrder.OrderId;
            ViewState["mOrder"] = mOrder;
            if (mOrder.LockLoginName == "")
            {
                lblLockId.Text   = "无";
                lblLockTime.Text = "";
            }
            else
            {
                lblLockId.Text   = mOrder.LockLoginName;
                lblLockTime.Text = mOrder.LockTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
            //查询挂起或者未挂的乘客
            sqlWhere = string.Format(" OrderId='{0}' and Suspended={1}", OrderId, ViewState["Type"].ToString());
            //乘机人信息
            IList <Tb_Ticket_Passenger> PassengerList = this.baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
            RepPassenger.DataSource = PassengerList;
            RepPassenger.DataBind();
            ViewState["mPassenger"] = PassengerList;

            //订单操作日志信息
            sqlWhere = string.Format(" OrderId='{0}' order by OperTime desc ", OrderId);
            IList <Log_Tb_AirOrder> OrderLogList = this.baseDataManage.CallMethod("Log_Tb_AirOrder", "GetList", null, new object[] { sqlWhere }) as List <Log_Tb_AirOrder>;
            RepOrderLog.DataSource = OrderLogList;
            RepOrderLog.DataBind();
        }
    }
Beispiel #16
0
        /*
         * /// <summary>
         * /// 订单支付金额:付款方 多人计算
         * /// </summary>
         * /// <param name="mOrder">订单 mOrder :订单最终返点、订单扣点明细</param>
         * /// <param name="mPassengers">乘机人 mOrder:舱位价、基建、燃油</param>
         * public decimal CreateOrderPayMoney(Tb_Ticket_Order mOrder, List<Model.Tb_Ticket_Passenger> mPassengers)
         * {
         *  decimal orderPayFee = 0; //订单支付金额
         *  try
         *  {
         *      if (mOrder != null && mPassengers != null && mPassengers.Count > 0)
         *      {
         *          decimal returnPoint = mOrder.ReturnPoint; //实际返点(扣点后)
         *          decimal XianFanPayFee = CreateXianFanPayFee(mOrder.DiscountDetail, mOrder.OldReturnMoney); //单人现返金额
         *
         *          foreach (Tb_Ticket_Passenger item in mPassengers)
         *          {
         *              orderPayFee += CreatePassengerPayFee(item.PMFee, item.ABFee, item.FuelFee, returnPoint, XianFanPayFee,item.PassengerType);
         *          }
         *      }
         *  }
         *  catch (Exception)
         *  {
         *
         *  }
         *  return orderPayFee;
         * }
         *
         * /// <summary>
         * /// 出票方收款金额:收款方 多人计算
         * /// </summary>
         * /// <param name="mOrder">订单 mOrder :订单最终返点、订单扣点明细</param>
         * /// <param name="mPassengers">乘机人 mOrder:舱位价、基建、燃油</param>
         * public decimal CreateOrderOrderMoney(Tb_Ticket_Order mOrder, List<Model.Tb_Ticket_Passenger> mPassengers)
         * {
         *  decimal orderPayFee = 0; //订单支付金额
         *  try
         *  {
         *      if (mOrder != null && mPassengers != null && mPassengers.Count > 0)
         *      {
         *          decimal returnPoint = mOrder.PolicyPoint; //实际返点(扣点后)
         *
         *          decimal XianFanPayFee = mOrder.ReturnMoney; //政策现返
         *
         *          foreach (Tb_Ticket_Passenger item in mPassengers)
         *          {
         *              orderPayFee += CreateOrderPayFeeGY(item.PMFee, item.ABFee, item.FuelFee, returnPoint, XianFanPayFee, item.PassengerType);
         *          }
         *      }
         *  }
         *  catch (Exception)
         *  {
         *
         *  }
         *  return orderPayFee;
         * }
         */

        /// <summary>
        /// 后返计算
        /// </summary>
        /// <param name="mOrder">订单 mOrder</param>
        /// <param name="mPassengers">乘机人 mOrder</param>
        /// <returns></returns>
        public decimal CreateOrderHFMoney(Tb_Ticket_Order mOrder, List <Model.Tb_Ticket_Passenger> mPassengers)
        {
            decimal orderHFMoney = 0; //金额

            try
            {
                if (mOrder != null && mPassengers != null && mPassengers.Count > 0)
                {
                    decimal returnPoint = mOrder.LaterPoint; //后返点

                    foreach (Tb_Ticket_Passenger item in mPassengers)
                    {
                        if (item.PassengerType != 3)
                        {
                            orderHFMoney += dataAction.MinusCeilSmallNum(item.PMFee * returnPoint / 100); //累计后返金额
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(orderHFMoney);
        }
    /// <summary>
    /// 确定改签
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        bool result = false;

        try
        {
            Tb_Ticket_Order            Order         = ViewState["Order"] as Tb_Ticket_Order;
            List <Tb_Ticket_Passenger> PassengerList = ViewState["Passenger"] as List <Tb_Ticket_Passenger>;

            Order.OrderStatusCode = 19;//改签成功,交易结束
            result = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().OperOrderGQ(Order, PassengerList, mUser, mCompany);
        }
        catch (Exception ex)
        {
        }
        if (result)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.Ticks.ToString(), "showdialogOne('确认改签成功!','" + ViewState["Url"].ToString() + "');", true);
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.Ticks.ToString(), "showdialog('确认改签失败!');", true);
        }
    }
Beispiel #18
0
        /// <summary>
        /// 在指定时间范围内是否可以提价申请
        /// </summary>
        /// <param name="ApplayType"></param>
        /// <param name="Order"></param>
        /// <returns></returns>
        private string TimeIsCommit(string ApplayType, Tb_Ticket_Order Order)
        {
            //true可以提交申请 false不能提交申请
            string msg = "";

            try
            {
                if (ApplayType == "3")//退票
                {
                }
                else if (ApplayType == "4")//废
                {
                    if (Order.CPTime.ToString("yyyy-MM-dd") == System.DateTime.Now.ToString("yyyy-MM-dd"))
                    {
                        //获取当天废票时间(接口和本地)
                        string[] strTime          = GetTime(Order);
                        string   PolicyCancelTime = strTime[1];
                        DateTime nowTime          = DateTime.Now.AddMinutes(20);//提交时间 ,提前20 分钟提交

                        if (PolicyCancelTime != "" && PolicyCancelTime.Split('-').Length == 2)
                        {
                            string start = DateTime.Now.ToString("yyyy-MM-dd") + " " + PolicyCancelTime.Split('-')[0] + ":00";
                            string end   = PolicyCancelTime.Split('-')[1] + ":00";
                            if (end == "00:00:00")
                            {
                                end = "23:59:59";
                            }
                            end = DateTime.Now.ToString("yyyy-MM-dd") + " " + end;
                            DateTime temp  = DateTime.Parse(start);
                            DateTime temp1 = DateTime.Parse(end);

                            //在指定时间范围内就可以提交
                            if (DateTime.Compare(temp, nowTime) < 0 && DateTime.Compare(temp1, nowTime) > 0)
                            {
                                //可以提交
                            }
                            else
                            {
                                //不能提交
                                msg = string.Format("不能提交废票申请,请在供应商下班前20分钟提交申请!{0}如有疑问请来电咨询!", Order.PolicyCancelTime != "" ? "处理时间(" + Order.PolicyCancelTime + ")" : "");
                            }
                        }
                        else
                        {
                            // 未设置时间 可以提交
                        }
                    }
                    else
                    {
                        //不是当天出票不能废

                        msg = string.Format("不能提交废票申请,请在供应商下班前20分钟提交申请!{0}如有疑问请来电咨询!", Order.PolicyCancelTime != "" ? "处理时间(" + Order.PolicyCancelTime + ")" : "");
                    }
                }
                else if (ApplayType == "5")//废
                {
                    //获取当天废票时间(接口和本地)
                    string[] strTime          = GetTime(Order);
                    string   PolicyCancelTime = strTime[1];
                    DateTime nowTime          = DateTime.Now.AddMinutes(20);//提交时间 ,提前20 分钟提交

                    if (PolicyCancelTime != "" && PolicyCancelTime.Split('-').Length == 2)
                    {
                        string start = DateTime.Now.ToString("yyyy-MM-dd") + " " + PolicyCancelTime.Split('-')[0] + ":00";
                        string end   = PolicyCancelTime.Split('-')[1] + ":00";
                        if (end == "00:00:00")
                        {
                            end = "23:59:59";
                        }
                        end = DateTime.Now.ToString("yyyy-MM-dd") + " " + end;
                        DateTime temp  = DateTime.Parse(start);
                        DateTime temp1 = DateTime.Parse(end);

                        //在指定时间范围内就可以提交
                        if (DateTime.Compare(temp, nowTime) < 0 && DateTime.Compare(temp1, nowTime) > 0)
                        {
                            //可以提交
                        }
                        else
                        {
                            //不能提交
                            msg = string.Format("不能提交改签申请,请在供应商下班前20分钟提交申请!{0}如有疑问请来电咨询!", Order.PolicyCancelTime != "" ? "处理时间(" + Order.PolicyCancelTime + ")" : "");
                        }
                    }
                    else
                    {
                        // 未设置时间 可以提交
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "时间判断有误,不能提交!";
            }

            return(msg);
        }
Beispiel #19
0
        /// <summary>
        /// 退废改签
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="parames"></param>
        public override void Update(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            UserLoginInfo userInfo = AuthLogin.GetUserInfo(Username);

            KongZhiXiTong = BaseParams.getParams(userInfo.SupParameters).KongZhiXiTong;

            PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
            string sqlWhere = " OrderID='" + CommonMethod.GetFomartString(parames["OrderID"]) + "' ";

            List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>;
            Tb_Ticket_Order        Order     = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null;

            if (Order == null)
            {
                writer.WriteEx(546, "order num err", "订单编号错误");
            }
            else
            {
                sqlWhere = " OrderId='" + Order.OrderId + "' ";
                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                List <Tb_Ticket_SkyWay>    NewSkyWayList = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { sqlWhere + " order by FromDate " }) as List <Tb_Ticket_SkyWay>;
                //提示信息
                string msg = "";

                try
                {
                    //申请类型3退票申请 4废票申请 5改签申请
                    string ApplayType = CommonMethod.GetFomartString(parames["ApplayType"]);
                    //扩展参数
                    ParamEx pe = new ParamEx();
                    pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0;
                    //发送指令管理类
                    SendInsManage SendIns = new SendInsManage(userInfo.User.LoginName, userInfo.Company.UninCode, pe, userInfo.Configparam);
                    //订单日志
                    StringBuilder orderLog = new StringBuilder();

                    #region

                    //选择的乘客信息
                    List <HashObject> pasList = GetPassengerInfo(Order, PassengerList, CommonMethod.GetFomartString(parames["pasList"]));
                    //选中的 成人 儿童 婴儿
                    int AdultCount = 0, CHDCount = 0, INFCount = 0;
                    //没选中的 成人 儿童 婴儿
                    int NoSelAdultCount = 0, NoSelCHDCount = 0, NoSelINFCount = 0;
                    //选择的乘机人
                    List <HashObject> selList = new List <HashObject>();
                    foreach (HashObject param in pasList)
                    {
                        if (param["pasIsBack"].ToString() == "0") //获取没有提交的用户
                        {
                            //选择的乘客数
                            if (param["IsChecked"].ToString() == "1")
                            {
                                if (param["pasPType"].ToString() == "1")
                                {
                                    AdultCount++;
                                }
                                else if (param["pasPType"].ToString() == "2")
                                {
                                    CHDCount++;
                                }
                                else if (param["pasPType"].ToString() == "3")
                                {
                                    INFCount++;
                                }
                                selList.Add(param);
                            }
                            else
                            {
                                if (param["pasPType"].ToString() == "1")
                                {
                                    NoSelAdultCount++;
                                }
                                else if (param["pasPType"].ToString() == "2")
                                {
                                    NoSelCHDCount++;
                                }
                                else if (param["pasPType"].ToString() == "3")
                                {
                                    NoSelINFCount++;
                                }
                            }
                        }
                    }

                    #endregion

                    //航段信息
                    List <HashObject> skyList = GetSkyInfo(Order, NewSkyWayList, CommonMethod.GetFomartString(parames["skywayList"]));

                    #region
                    if (ApplayType != "5")//退废票
                    {
                        //行程单状态判断
                        if (!KongZhiXiTong.Contains("|68|"))
                        {
                            if (string.IsNullOrEmpty(msg))
                            {
                                //行程单状态判断
                                if (!TripIsVoid(userInfo, pasList, SendIns, out msg))
                                {
                                    msg = (string.IsNullOrEmpty(msg)) ? "不能提交,行程单状态异常!" : msg;
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(msg))
                        {
                            //票号状态判断
                            if (!KongZhiXiTong.Contains("|69|"))
                            {
                                if (string.IsNullOrEmpty(msg))
                                {
                                    //票号状态判断
                                    if (!PassengerTicketIsOpen(pasList, skyList, SendIns, out msg))
                                    {
                                        msg = (string.IsNullOrEmpty(msg)) ? "不能提交,票号状态异常!" : msg;
                                    }
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(msg))
                        {
                            //废票 飞机起飞两个半小时内不能提交废票操作,只能走退票通道
                            if (ApplayType == "4" && skyList.Count > 0)
                            {
                                //是否可以提交废票 1可以 0不可以
                                HashObject strArr = skyList[0] as HashObject;

                                if (strArr.Count == 11 && strArr["IsFP"].ToString() == "0")
                                {
                                    if (KongZhiXiTong != null && !KongZhiXiTong.Contains("|16|"))
                                    {
                                        msg = "飞机起飞两个半小时内不能提交废票操作,只能走退票通道";
                                    }
                                }
                            }
                        }
                    }

                    #endregion

                    if (string.IsNullOrEmpty(msg))
                    {
                        msg = TimeIsCommit(ApplayType, Order);
                    }

                    if (string.IsNullOrEmpty(msg))
                    {
                        //含有没有提交的婴儿并且没有成人时 不可以提交
                        if (NoSelINFCount > 0 && NoSelAdultCount == 0)
                        {
                            msg = "婴儿订单必须有成人陪同!";
                            orderLog.Append("成人带婴儿订单,需要手动处理编码!");
                        }
                    }

                    if (string.IsNullOrEmpty(msg))
                    {
                        string divMsg = "";
                        if (Order.OrderSourceType == 1)//白屏预订
                        {
                            //退费票且没有婴儿
                            if (ApplayType != "5" && (AdultCount > 0 || CHDCount > 0))
                            {
                                //开启退废票(分离、取消)编码
                                if (KongZhiXiTong.Contains("|32|"))
                                {
                                    ////退废处理 判断 分离编码 和 取消编码
                                    divMsg = PnrHandle(Order, SendIns, orderLog, selList, INFCount);
                                }
                            }
                        }
                        if (divMsg != "" && INFCount == 0)
                        {
                        }
                        else
                        {
                            //处理退改签
                            msg = TGQ(userInfo, Order, NewSkyWayList, skyList, PassengerList, pasList,
                                      CommonMethod.GetFomartString(parames["remark"]),
                                      CommonMethod.GetFomartString(parames["quitReasonType"]),
                                      CommonMethod.GetFomartString(parames["reason"]));
                        }
                    }
                    else
                    {
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    //解锁
                    orderBll.LockOrder(false, Order.id.ToString(), userInfo.User, userInfo.Company);
                    writer.Write(msg);
                }
            }
        }
Beispiel #20
0
        /// <summary>
        /// 生成没有政策信息的订单,确定订单时回写政策数据
        /// </summary>
        /// <param name="FQP"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool GenerationOrder(UserLoginInfo userLogin, List <Tb_Ticket_SkyWay> skyWay, List <Tb_Ticket_Passenger> pasList, RePnrObj pnrInfo, out string msg)
        {
            bool IsSuc = false;

            msg = "";
            //儿童备注关联成人编码
            string RmkAdultPnr = "";
            //是否为两个订单
            bool IsSecOrder   = false;
            bool IsExistAdult = false;
            bool IsExistCHD   = false;
            bool IsExistINF   = false;

            try
            {
                Tb_Ticket_Order AdultOrder = null, ChildOrder = null;
                if (userLogin.Company == null || userLogin.BaseParametersList == null)
                {
                    msg = "mCompany公司信息丢失";
                    return(IsSuc);
                }
                //订单管理
                Tb_Ticket_OrderBLL  OrderManage = new Tb_Ticket_OrderBLL();
                OrderInputParam     OrderParam  = new OrderInputParam();
                OrderMustParamModel ParamModel  = new OrderMustParamModel();

                //构造生成订单需要的信息
                List <Tb_Ticket_SkyWay> SkyWay1 = skyWay;
                //构造乘客信息
                List <Tb_Ticket_Passenger> Paslist = pasList;
                //订单日志记录
                Log_Tb_AirOrder logOrder = new Log_Tb_AirOrder();
                logOrder.OperTime      = DateTime.Now;
                logOrder.OperType      = "创建订单";
                logOrder.OperContent   = userLogin.User.LoginName + "于" + logOrder.OperTime + "创建订单。";
                logOrder.OperLoginName = userLogin.User.LoginName;
                logOrder.OperUserName  = userLogin.User.UserName;
                logOrder.CpyNo         = userLogin.Company.UninCode;
                logOrder.CpyName       = userLogin.Company.UninName;
                logOrder.CpyType       = userLogin.Company.RoleType;
                logOrder.WatchType     = 5;
                if (IsExistCHD)
                {
                    //添加权限 是否可以预定儿童票 未加
                    if (userLogin.FQP.GongYingKongZhiFenXiao != null && userLogin.FQP.GongYingKongZhiFenXiao.Contains("|90|"))
                    {
                        msg = "目前暂时无法预订儿童票!";
                    }
                }

                //关联成人订单号
                if (isAsAdultOrder)
                {
                    #region 关联成人订单号
                    //开启儿童编码必须关联成人编码或者成人订单号
                    if (userLogin.FQP.KongZhiXiTong != null && userLogin.FQP.KongZhiXiTong.Contains("|95|"))
                    {
                        string sqlWhere = "";
                        //儿童订单关联成人订单号
                        if (cHDAssociationAdultOrderId == "")
                        {
                            msg = "关联成人订单不能为空!";
                        }
                        else
                        {
                            sqlWhere = string.Format(" OrderId='{0}' ", cHDAssociationAdultOrderId);

                            List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { sqlWhere }) as List <Tb_Ticket_Order>;
                            if (list != null && list.Count > 0)
                            {
                                if (list[0].IsChdFlag)
                                {
                                    msg = "该订单非成人订单!";
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(list[0].PNR))
                                    {
                                        msg = "该订单还未生成编码!";
                                    }
                                    else if (list[0].OrderStatusCode < 4)
                                    {
                                        msg = "关联成人订单未出票!";
                                    }
                                    else
                                    {
                                        RmkAdultPnr = list[0].PNR;
                                    }
                                    //添加权限是否验证 儿童航段与关联成人航段信息是否一致 还未加权限
                                    if (userLogin.FQP.KongZhiXiTong == null || !userLogin.FQP.KongZhiXiTong.Contains("|91|"))
                                    {
                                        if (msg == "" && !ValSkyWay(cHDAssociationAdultOrderId, SkyWay1))
                                        {
                                            msg = "成人订单航程与儿童订单航程信息不一致,无法预定!";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                msg = "关联成人订单不存在!";
                            }
                        }
                    }
                    #endregion
                }
                //关联订单号通过
                if (msg == "")
                {
                    #region 生成编码记录编码信息
                    //航空公司 出票Office 和儿童编码所备注的成人编码
                    string defaultOffice = userLogin.Configparam.Office.Split('^')[0];
                    string CpyNo = userLogin.Company.UninCode, CarryCode = SkyWay1[0].CarryCode;
                    string PrintOffice = GetPrintOffice(CpyNo, CarryCode);
                    if (!string.IsNullOrEmpty(PrintOffice))
                    {
                        //Office = PrintOffice;
                    }

                    //记录指令
                    SaveInsInfo(pnrInfo, userLogin);
                    pnrInfo.PrintOffice = PrintOffice;
                    //记录Pnr日志Id=
                    List <string> pnrLogList = new List <string>();
                    string        AdultPnr   = string.Empty;
                    string        childPnr   = string.Empty;
                    //成人预订信息编码记录
                    if (pnrInfo.AdultYudingList.Count > 0)
                    {
                        AdultPnr = pnrInfo.AdultPnr;
                        if (string.IsNullOrEmpty(AdultPnr) || AdultPnr.Trim().Length != 6)
                        {
                            //提示pnr失败信息
                            string yudingRecvData = pnrInfo.AdultYudingList.Values[0];
                            msg      = ShowPnrFailInfo(1, yudingRecvData);
                            AdultPnr = "";
                        }
                        //记录编码日志
                        YuDingPnrLog(userLogin, pnrInfo, pnrInfo.AdultYudingList.Keys[0], pnrInfo.AdultYudingList.Values[0], AdultPnr, pnrInfo.Office, ref pnrLogList);
                        if (AdultPnr.Length == 6 && (pnrInfo.PatModelList[0] == null || pnrInfo.PatModelList[0].PatList.Count == 0))
                        {
                            msg = "成人编码" + AdultPnr + "未能PAT取到价格,原因如下:<br />" + pnrInfo.PatList[0];
                        }
                    }
                    //儿童预订信息编码记录
                    if (pnrInfo.ChildYudingList.Count > 0)
                    {
                        childPnr = pnrInfo.childPnr;
                        if (string.IsNullOrEmpty(childPnr) || childPnr.Trim().Length != 6)
                        {
                            //提示pnr失败信息
                            string yudingRecvData = pnrInfo.ChildYudingList.Values[0];
                            msg      = ShowPnrFailInfo(2, yudingRecvData);
                            childPnr = "";
                        }
                        //记录编码日志
                        YuDingPnrLog(userLogin, pnrInfo, pnrInfo.ChildYudingList.Keys[0], pnrInfo.ChildYudingList.Values[0], childPnr, pnrInfo.Office, ref pnrLogList);
                        if (childPnr.Length == 6 && (pnrInfo.PatModelList[1] == null || pnrInfo.PatModelList[1].PatList.Count == 0))
                        {
                            msg = "儿童编码" + childPnr + "未能PAT取到价格,原因如下:<br />" + pnrInfo.PatList[0];
                        }
                    }
                    #endregion

                    #region 组合生成订单所需要的实体数据
                    //成人+婴儿 成人+成人 儿童+备注成人订单号  只生成一个订单
                    //成人+儿童且没有备注订单号  成人+儿童+婴儿   生成两个订单
                    //存在儿童 也存在成人
                    if (IsExistCHD && IsExistAdult)
                    {
                        if (!isAsAdultOrder)
                        {
                            IsSecOrder = true;
                            //生成儿童订单
                            List <Tb_Ticket_SkyWay> SkyWay2 = skyWay;
                            //儿童乘客列表
                            List <Tb_Ticket_Passenger> ChildList = new List <Tb_Ticket_Passenger>();
                            foreach (Tb_Ticket_Passenger pas in Paslist)
                            {
                                if (pas.PassengerType == 2)
                                {
                                    ChildList.Add(pas);
                                }
                            }
                            ChildOrder = GetOrder(userLogin, true, ChildList, SkyWay2);
                            Log_Tb_AirOrder logOrder1 = new Log_Tb_AirOrder();
                            logOrder1.OperTime      = DateTime.Now;
                            logOrder1.OperType      = "创建订单";
                            logOrder1.OperContent   = userLogin.User.LoginName + "于" + logOrder.OperTime + "创建订单。";
                            logOrder1.OperLoginName = userLogin.User.LoginName;
                            logOrder1.OperUserName  = userLogin.User.UserName;
                            logOrder1.CpyNo         = userLogin.Company.UninCode;
                            logOrder1.CpyName       = userLogin.Company.UninName;
                            logOrder1.CpyType       = userLogin.Company.RoleType;
                            logOrder1.WatchType     = 5;

                            //加入参数
                            OrderMustParamModel ParamModel1 = new OrderMustParamModel();
                            OrderParam.PnrInfo   = pnrInfo;
                            ParamModel1.PasList  = ChildList;
                            ParamModel1.SkyList  = SkyWay2;
                            ParamModel1.Order    = ChildOrder;
                            ParamModel1.LogOrder = logOrder1;
                            //加入集合
                            OrderParam.OrderParamModel.Add(ParamModel1);
                        }
                    }
                    //为两个订单时
                    if (IsSecOrder)
                    {
                        //排除儿童乘客
                        List <Tb_Ticket_Passenger> NotCHDList = new List <Tb_Ticket_Passenger>();
                        foreach (Tb_Ticket_Passenger item in Paslist)
                        {
                            if (item.PassengerType != 2)
                            {
                                NotCHDList.Add(item);
                            }
                        }
                        Paslist    = NotCHDList;
                        AdultOrder = GetOrder(userLogin, false, Paslist, SkyWay1);
                    }
                    else
                    {
                        //为一个订单时
                        AdultOrder = GetOrder(userLogin, IsExistCHD, Paslist, SkyWay1);
                        if (isAsAdultOrder)
                        {
                            AdultOrder.PNR = RmkAdultPnr;
                            AdultOrder.AssociationOrder = cHDAssociationAdultOrderId;
                        }
                    }
                    //  是否有婴儿
                    AdultOrder.HaveBabyFlag = IsExistINF;
                    //
                    OrderParam.PnrInfo  = pnrInfo;
                    ParamModel.PasList  = Paslist;
                    ParamModel.SkyList  = SkyWay1;
                    ParamModel.Order    = AdultOrder;
                    ParamModel.LogOrder = logOrder;
                    //加入集合
                    OrderParam.OrderParamModel.Add(ParamModel);
                    #endregion
                    if (pnrLogList.Count > 0 && !(AdultPnr == "" && childPnr == ""))
                    {
                        string UpdatePnrLogSQL = string.Format(" update Log_Pnr set OrderFlag=1 where id in({0}) ", string.Join(",", pnrLogList.ToArray()));
                        OrderParam.ExecSQLList.Add(UpdatePnrLogSQL);
                    }
                }
                //前面都通过
                if (msg == "")
                {
                    string ErrMsg = "";
                    //生成订单
                    IsSuc = OrderManage.CreateOrder(ref OrderParam, out ErrMsg);
                    List <string> Paramlist = new List <string>();
                    //两个订单url处理
                    foreach (OrderMustParamModel item in OrderParam.OrderParamModel)
                    {
                        if (item.Order.IsChdFlag)
                        {
                            Paramlist.Add("ChildOrderId=" + item.Order.OrderId);
                        }
                        else
                        {
                            Paramlist.Add("AdultOrderId=" + item.Order.OrderId);
                        }
                    }
                    if (IsSuc)
                    {
                        msg = string.Join("&", Paramlist.ToArray());
                    }
                    else
                    {
                        //出错信息
                        msg = ErrMsg;
                    }
                }
            }
            catch (Exception ex)
            {
                //异常信息
                msg   = ex.Message;
                IsSuc = false;
            }
            return(IsSuc);
        }
Beispiel #21
0
        /// <summary>
        ///  构造机票订单实体
        /// </summary>
        /// <param name="FQP">航班查询参数实体</param>
        /// <param name="IsChild">是否为儿童订单 true 是 false 不是</param>
        /// <param name="AllowChangePNRFlag">是否允许换编码 true 是 false 不是</param>
        /// <param name="IsETDZAudltTK">是否儿童出成人票 true 是 false 不是 </param>
        /// <param name="PasList">乘机人列表</param>
        /// <param name="SkyWayList">航段列表</param>
        /// <returns></returns>
        private Tb_Ticket_Order GetOrder(UserLoginInfo userLogin, bool IsChild, List <Tb_Ticket_Passenger> PasList, List <Tb_Ticket_SkyWay> SkyWayList)
        {
            Tb_Ticket_Order to = new Tb_Ticket_Order();

            try
            {
                to.LinkMan      = linkMan == "" ? userLogin.Company.ContactUser : linkMan;
                to.LinkManPhone = linkManPhone == "" ? userLogin.Company.ContactTel : linkManPhone;
                //白屏预订
                to.OrderSourceType = 5; //
                to.OrderStatusCode = 1; //默认新订单等待支付
                to.PolicySource    = 1; //默认b2b


                to.CreateCpyName = userLogin.Company != null ? userLogin.Company.UninAllName : "";
                to.CreateCpyNo   = userLogin.Company != null ? userLogin.Company.UninCode : "";

                to.CreateLoginName = userLogin.User.LoginName;
                to.CreateUserName  = userLogin.User.UserName;
                to.OwnerCpyNo      = userLogin.Company != null ? userLogin.Company.UninCode : "";
                to.OwnerCpyName    = userLogin.Company != null ? userLogin.Company.UninAllName : "";
                //是否允许换编码出票
                to.AllowChangePNRFlag = allowChangePNRFlag;

                to.TravelType = int.Parse(travelType);
                to.CarryCode  = SkyWayList[0].CarryCode;
                to.FlightCode = SkyWayList[0].FlightCode;

                //to.AirTime = GetAirTime(ViewState["Time"].ToString());
                to.AirTime = SkyWayList[0].FromDate;

                to.Travel     = SkyWayList[0].FromCityName + "-" + SkyWayList[0].ToCityName + (SkyWayList.Count == 1 ? "" : "/" + SkyWayList[1].FromCityName + "-" + SkyWayList[1].ToCityName);
                to.TravelCode = SkyWayList[0].FromCityCode + "-" + SkyWayList[0].ToCityCode + (SkyWayList.Count == 1 ? "" : "/" + SkyWayList[1].FromCityCode + "-" + SkyWayList[1].ToCityCode);
                to.Space      = SkyWayList[0].Space + (SkyWayList.Count == 1 ? "" : "/" + SkyWayList[1].Space);;
                to.Discount   = SkyWayList[0].Discount + (SkyWayList.Count == 1 ? "" : "/" + SkyWayList[1].Discount);

                //乘客人数
                to.PassengerNumber = PasList.Count;
                //乘客姓名 已"|"分割
                List <string> PasNameList = new List <string>();
                foreach (Tb_Ticket_Passenger item in PasList)
                {
                    PasNameList.Add(item.PassengerName);
                }
                to.PassengerName = string.Join("|", PasNameList.ToArray());


                //为儿童订单 且儿童不出成人票
                if (IsChild)
                {
                    if (!isCHDToAudltTK)
                    {
                        to.ABFee = 0m;
                        //to.FuelFee = (0.5m) * decimal.Parse(FQP.FuelAdultFee.ToString().Split('~')[0]);
                        to.Space    = "Y";
                        to.Discount = "100";
                    }
                    to.IsChdFlag = true;//儿童
                    ///是否儿童出成人票
                    to.IsCHDETAdultTK = isCHDToAudltTK ? 1 : 0;
                }
                else
                {
                    to.ABFee     = 0;
                    to.FuelFee   = 0;
                    to.IsChdFlag = false;//成人
                }
                //客规
                to.KeGui = "";
            }
            catch (Exception ep)
            {
                DataBase.LogCommon.Log.Error("生成PNR页面GetOrder", ep);
            }
            return(to);
        }
Beispiel #22
0
        /// <summary>
        /// 处理退改签 处理
        /// </summary>
        private string TGQ(UserLoginInfo userInfo, Tb_Ticket_Order Order, List <Tb_Ticket_SkyWay> OldSkyWayList, List <HashObject> newSkyWay, List <Tb_Ticket_Passenger> oldPassengerList, List <HashObject> newPasList, string TGQRemark, string quitReasonType, string reason)
        {
            bool   result = false;
            string msg    = "";
            //选择申请类型
            int ApplayType = int.Parse(CommonMethod.GetFomartString(parames["ApplayType"]));

            try
            {
                //订单管理类
                Tb_Ticket_OrderBLL OrderManage = new Tb_Ticket_OrderBLL();

                List <Tb_Ticket_Passenger> tempPassengerList = new List <Tb_Ticket_Passenger>();

                //记录出票订单id
                List <string> passengerId = new List <string>();
                List <Tb_Ticket_Passenger> NewPassengerList = new List <Tb_Ticket_Passenger>();
                Tb_Ticket_Passenger        Passenger        = null;
                //新订单号
                string NewOrderId = OrderManage.GetOrderId("0");
                int    TicketNum  = 0;

                #region 处理乘机人
                string strId = "", IsChecked = "0";
                for (int i = 0; i < newPasList.Count; i++)
                {
                    Passenger = new Tb_Ticket_Passenger();
                    //strId = newPasList[i].GetValue<string>("id");
                    strId = newPasList[i]["id"].ToString();
                    //IsChecked = newPasList[i].GetValue<string>("IsChecked");
                    IsChecked = newPasList[i]["IsChecked"].ToString();
                    Guid id = Guid.Parse(strId);

                    if (oldPassengerList != null && oldPassengerList.Count > 0)
                    {
                        tempPassengerList = oldPassengerList.Where(w => w.id == id).ToList <Tb_Ticket_Passenger>();
                    }

                    if (tempPassengerList != null && tempPassengerList.Count > 0)
                    {
                        Passenger = tempPassengerList[0];
                    }

                    //选中的乘客
                    if (IsChecked == "1")
                    {
                        //原乘客id
                        //passengerId.Add(newPasList[i].GetValue<string>("id"));
                        passengerId.Add(newPasList[i]["id"].ToString());
                        Passenger.id = Guid.NewGuid();
                        NewPassengerList.Add(Passenger);
                        TicketNum++;
                    }
                }

                #endregion

                #region 处理航段表

                //改签用到航班号和舱位
                List <string> FlightCodeList = new List <string>();
                List <string> SpaceList      = new List <string>();
                //临时日期
                DateTime TempDate = DateTime.Parse("1901-01-01");
                DateTime fromDate = DateTime.Parse("1901-01-01");
                for (int i = 0; i < OldSkyWayList.Count; i++)
                {
                    //处理改签航段
                    if (ApplayType == 5)
                    {
                        foreach (HashObject skyParam in newSkyWay)
                        {
                            //找到相同航段id
                            if (skyParam.GetValue <string>("SkyId") == OldSkyWayList[i].id.ToString())
                            {
                                if (DateTime.TryParse(skyParam.GetValue <string>("FromDate"), out fromDate))
                                {
                                    OldSkyWayList[i].FromDate = fromDate;
                                }
                                if (TempDate.ToString("yyyy-MM-dd") == "1901-01-01")
                                {
                                    TempDate = OldSkyWayList[i].FromDate;
                                }
                                if (DateTime.TryParse(skyParam.GetValue <string>("ToDate"), out fromDate))
                                {
                                    OldSkyWayList[i].ToDate = fromDate;
                                }
                                OldSkyWayList[i].FlightCode = skyParam.GetValue <string>("FlightCode");
                                OldSkyWayList[i].Space      = skyParam.GetValue <string>("Space");
                                //航班号和舱位
                                FlightCodeList.Add(OldSkyWayList[i].FlightCode);
                                SpaceList.Add(OldSkyWayList[i].Space);
                            }
                        }
                    }
                    //新id
                    OldSkyWayList[i].id = Guid.NewGuid();
                }

                #endregion

                if (TicketNum == 0)
                {
                    msg = "请选择乘客!";
                }
                else
                {
                    string PassengerNameS = "";
                    foreach (Tb_Ticket_Passenger item in NewPassengerList)
                    {
                        PassengerNameS += item.PassengerName + "|";
                    }
                    PassengerNameS = PassengerNameS.TrimEnd('|');


                    //新id
                    Order.id              = Guid.NewGuid();
                    Order.PassengerName   = PassengerNameS;
                    Order.PassengerNumber = NewPassengerList.Count;
                    Order.OldOrderId      = Order.OrderId; //原订单号
                    Order.OrderId         = NewOrderId;    //新订单号
                    //Order.PayNo = "";
                    Order.InPayNo       = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetIndexId();
                    Order.TicketStatus  = ApplayType; //机票状态
                    Order.CreateTime    = DateTime.Now;
                    Order.YDRemark      = TGQRemark;  //退改签申请备注
                    Order.PayDebtsMoney = 0;
                    Order.LockLoginName = "";
                    Order.LockCpyNo     = "";
                    Order.LockTime      = DateTime.Parse("1900-01-01 00:00:00.000");

                    string strType = "";

                    if (ApplayType == 3)//退票
                    {
                        Order.OrderStatusCode = 7;
                        Order.A8 = quitReasonType;

                        if (quitReasonType == "1")
                        {
                            strType = "自愿申请";
                            Order.TGQApplyReason = reason + "--自愿申请";  //申请退票理由:自愿
                        }
                        else
                        {
                            strType = "非自愿申请";
                            Order.TGQApplyReason = reason + "--非自愿申请"; //申请退票理由:非自愿
                        }
                    }
                    else if (ApplayType == 4)//废票
                    {
                        Order.OrderStatusCode = 8;
                        Order.TGQApplyReason  = reason; //申请废票理由
                    }
                    else if (ApplayType == 5)           //改签
                    {
                        Order.OrderStatusCode = 6;
                        Order.AirTime         = TempDate;
                        Order.FlightCode      = string.Join("/", FlightCodeList.ToArray());
                        Order.Space           = string.Join("/", SpaceList.ToArray());
                        //改签申请理由
                        Order.TGQApplyReason = reason;

                        //改签处理其它参数
                        Order.PayWay = 0; //默认支付方式
                        Order.PayNo  = "";
                    }

                    string isContent = ""; //是否保留编码日志

                    //生成订单
                    result = OrderManage.CreateOrderTFG(Order, NewPassengerList, passengerId, OldSkyWayList, userInfo.User, userInfo.Company, strType, isContent, out msg);
                }
            }
            catch (Exception ex)
            {
            }
            string values = "";

            if (result)
            {
                values = "订单申请成功!";
            }
            else
            {
                if (string.IsNullOrEmpty(msg))
                {
                    if (ApplayType == 3)
                    {
                        values = "订单申请退票失败!";
                    }
                    else if (ApplayType == 4)
                    {
                        values = "订单申请废票失败!";
                    }
                    else if (ApplayType == 5)
                    {
                        values = "订单申请改签失败!";
                    }
                }
                else
                {
                    values = msg;
                }
            }

            return(values);
        }
    /// <summary>
    /// repCabinList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repOrderList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            string Id     = e.CommandArgument.ToString();
            string msg    = "";
            string result = "";

            if (e.CommandName == "PaySel")//支付状态查询
            {
                #region 支付状态查询

                for (int i = 1; i <= 4; i++)
                {
                    result = new PbProject.Logic.Pay.OperOnline().PaySel(i.ToString(), Id, true, out msg);
                    if (msg.Contains("交易成功"))
                    {
                        break;
                    }
                }
                if (msg.Contains("交易成功"))
                {
                    OrderListDataBind();
                }

                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
                #endregion
            }
            else if (e.CommandName == "RefundSel")//退款查询
            {
                #region 退款查询

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = null; //订单

                if (mOrderList != null && mOrderList.Count > 0)
                {
                    Order = mOrderList[0];
                }
                if (Order != null && Order.PayWay > 0 && Order.PayWay < 13 &&
                    (Order.OrderStatusCode == 5 || Order.OrderStatusCode == 16 || Order.OrderStatusCode == 17 ||
                     Order.OrderStatusCode == 20 || Order.OrderStatusCode == 21 || Order.OrderStatusCode == 22 || Order.OrderStatusCode == 23))
                {
                    result = new PbProject.Logic.Pay.OperOnline().RefundSel(Order, out msg);
                }
                else
                {
                    msg = "订单状态有误,不能退款查询!";
                }

                result = "<textarea style='width:760px; height:360px; background-color:Black; color:Green;'>" + result + "</textarea>";
                string strValue = escape("<span style='color:Red; font-size:18px;'><b>" + msg + "</b></span>" + result);

                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialogNew('" + strValue + "');", true);
                #endregion
            }
            else if (e.CommandName == "Refund")//退款处理
            {
                #region 退款处理

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = null; //订单

                if (mOrderList != null && mOrderList.Count > 0)
                {
                    Order = mOrderList[0];
                }
                if (Order != null && (Order.OrderStatusCode == 20 || Order.OrderStatusCode == 21 || Order.OrderStatusCode == 22 || Order.OrderStatusCode == 23))
                {
                    #region 拒绝出票退款处理

                    bool rs = new PbProject.Logic.Pay.OperOnline().TitckOrderRefund(Order, mUser, mCompany, out msg);

                    if (rs)
                    {
                        msg = "";
                    }
                    else
                    {
                        msg = "退款处理失败!" + msg;
                    }
                    #endregion
                }
                else
                {
                    msg = "订单状态有误,不能退款处理!";
                }

                if (msg == "")
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "TitckOrderRefund();", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
                }

                #endregion
            }
            else if (e.CommandName == "Detail")//订单详情
            {
                Response.Redirect("OrderDetail.aspx?Id=" + Id + "&Url=OrderList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "UpdateOrder") //修改订单
            {
                Response.Redirect("OrderUpdate.aspx?Id=" + Id + "&Url=OrderList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "unLock")//解锁
            {
                Tb_Ticket_OrderBLL service = new Tb_Ticket_OrderBLL();
                if (service.OrderUnLock(Id))
                {
                    msg = "此订单已解锁成功!";
                    OrderListDataBind();
                }
                else
                {
                    msg = "解锁失败,请稍后再试!";
                }
                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
            }
        }
        catch (Exception)
        {
        }
    }
    /// <summary>
    /// repList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            string Id  = e.CommandArgument.ToString();
            string Url = Server.UrlEncode(string.Format("OrderTGQList.aspx?{0}", queryparam.Value));
            if (e.CommandName == "Detail") //订单详情
            {
                Response.Redirect("OrderDetail.aspx?Id=" + Id + "&currentuserid=" + this.currentuserid.Value.ToString() + "&Url=" + Url);
            }
            else if (e.CommandName == "GQOk")//确定改签
            {
                #region 判断订单 是否锁定

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = mOrderList[0];

                if (!string.IsNullOrEmpty(Order.LockLoginName) && !string.IsNullOrEmpty(Order.LockCpyNo))
                {
                    if (Order.LockLoginName.Trim() == mUser.LoginName.Trim())
                    {
                        //本账号锁定
                    }
                    else
                    {
                        //非本账号锁定
                        ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('订单已被锁定,不能处理!');", true);
                        return;
                    }
                }
                else
                {
                    //锁定订单
                    new Tb_Ticket_OrderBLL().LockOrder(true, Order.id.ToString(), mUser, mCompany);
                }

                #endregion

                Response.Redirect("OrderGQSuccess.aspx?Id=" + Id + "&currentuserid=" + this.currentuserid.Value.ToString() + "&Url=" + Url);
            }
            else if (e.CommandName == "OrderProces" || e.CommandName == "TPExamine") // //订单处理 或者 退款
            {
                #region 判断订单 是否锁定

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = mOrderList[0];


                if (!string.IsNullOrEmpty(Order.LockLoginName) && Order.LockLoginName != mUser.LoginName)
                {
                    //订单锁定 并且 非登录本账号锁定
                    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('订单已被锁定,不能处理!')", true);
                }
                else
                {
                    new Tb_Ticket_OrderBLL().LockOrder(true, Order.id.ToString(), mUser, mCompany);
                    Response.Redirect("TGQProcess.aspx?Id=" + Id + "&currentuserid=" + this.currentuserid.Value.ToString() + "&Url=" + Url);
                }

                #endregion
            }
        }
        catch (Exception)
        {
        }
    }
        /// <summary>
        /// 支付宝自动出票
        /// </summary>
        /// <param name="passengerManage"></param>
        /// <param name="order"></param>
        /// <param name="Log"></param>
        private void AlipayTicketWork(Tb_Ticket_PassengerBLL passengerManage, Tb_Ticket_Order order, ListParam LPm, B2BShowLog Log)
        {
            PbProject.Logic.Pay.AliPay alipay             = new PbProject.Logic.Pay.AliPay();
            PbProject.Model.definitionParam.BaseSwitch BS = new PbProject.Model.definitionParam.BaseSwitch();
            string GYCpyNo = order.CPCpyNo;

            if (GYCpyNo.Length >= 12)
            {
                GYCpyNo = GYCpyNo.Substring(0, 12);
                PbProject.Model.User_Company mTopcom = new PbProject.Logic.User.User_CompanyBLL().GetCompany(GYCpyNo);
                PbProject.Logic.ControlBase.Bd_Base_ParametersBLL Bp      = new PbProject.Logic.ControlBase.Bd_Base_ParametersBLL();
                List <PbProject.Model.Bd_Base_Parameters>         ParList = Bp.GetParametersListByCpyNo(mTopcom.UninCode.ToString());
                BS = PbProject.WebCommon.Utility.BaseParams.getParams(ParList);

                string msg         = "";
                string UpdateFiled = "";
                string sql         = "";
                try
                {
                    //锁定订单
                    sql = string.Format(" update Tb_Ticket_Order set LockCpyNo='{0}' ,LockTime='{1}',LockLoginName='系统管理员' where OrderId='{2}' ", GYCpyNo, System.DateTime.Now, order.OrderId);
                    Manage.ExecuteNonQuerySQLInfo(sql);

                    bool IsOk = alipay.AutoPay(order, BS, ref msg);
                    //失败请求次数默认
                    int times = 3;
                    try
                    {
                        times = string.IsNullOrEmpty(BS.AutoPayAccount.Split('^')[1]) ? 1 : Convert.ToInt32(BS.AutoPayAccount.Split('^')[1]);
                    }
                    catch (Exception)
                    {
                        Log(2, "错误:失败次数未取到, 订单号:" + order.OrderId + " " + BS.AutoPayAccount + "\r\n");
                    }
                    //请求成功
                    if (IsOk)
                    {
                        //添加操作订单的内容
                        string LogCon = "于 " + DateTime.Now + " 自动出票启动成功,请等待航空公司出票后系统自动回帖票号";
                        OrderLog(order.OrderId, LogCon, LPm, "1");
                        Log(2, string.Format("出票成功,订单ID{0}", order.OrderId) + "\r\n");
                        UpdateFiled = " A10=1 ,";//标识已请求成功
                    }
                    else
                    {
                        Log(2, string.Format("订单ID{0},出票信息:{1}", order.OrderId, msg) + "\r\n");
                        for (int i = 0; i < times; i++)
                        {
                            IsOk = alipay.AutoPay(order, BS, ref msg);
                            Log(2, string.Format("订单ID{0},出票信息:{1}", order.OrderId, msg) + "\r\n");
                            if (IsOk)
                            {
                                //添加操作订单的内容
                                string LogCon = "于 " + DateTime.Now + " 自动出票启动成功,请等待航空公司出票后系统自动回帖票号";
                                OrderLog(order.OrderId, LogCon, LPm, "1");
                                Log(2, string.Format("出票成功,订单ID{0}", order.OrderId) + "\r\n");
                                UpdateFiled = " A10=1 ,";//标识已请求成功
                                break;
                            }
                            if (i >= times - 1)
                            {
                                #region 记录操作日志
                                //记录日志
                                if (msg == "未查到符合支付价格的政策")
                                {
                                    msg = "与航空公司网站价格不符合";
                                }
                                string LogCon = "于 " + DateTime.Now + " 第" + (i + 1).ToString() + "次调用自动出票失败,失败原因:" + msg;
                                OrderLog(order.OrderId, LogCon, LPm, "1");
                                #endregion
                                UpdateFiled = " A10=2,AutoPrintFlag=0 ,";//标识已请求成功
                            }
                            Thread.Sleep(1);
                        }
                    }
                }
                catch (Exception ex)
                {
                    try
                    {
                        Log(2, "发生不可预料的异常:" + ex.Message + "该功能停止,请重新启动,如果继续发生请联系开发人员解决,谢谢!\r\n");
                        if (ex is ThreadAbortException)
                        {
                            return;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                finally
                {
                    //解锁订单
                    sql = string.Format(" update Tb_Ticket_Order set " + UpdateFiled + " LockCpyNo='',LockLoginName='' ,LockTime='{0}' where OrderId='{1}' ", System.DateTime.Now, order.OrderId);
                    Manage.ExecuteNonQuerySQLInfo(sql);
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// 收银支付
        /// </summary>
        /// <param name="mOrder">订单mOrder</param>
        /// <param name="mUser">当前操作员model</param>
        /// <param name="mCompany">当前公司model</param>
        /// <param name="messge">消息</param>
        /// <returns></returns>
        public bool CashRegisterPay(Tb_Ticket_Order mOrder, User_Employees mUser, User_Company mCompany, out string messge)
        {
            lock (lockobject)
            {
                bool result = false;
                messge = "";
                try
                {
                    //修改订单 状态 和 添加日志
                    #region 1.修改订单

                    StringBuilder updateOrder = new StringBuilder();
                    updateOrder.Append(" update Tb_Ticket_Order set ");
                    updateOrder.Append(" PayWay=15,");
                    updateOrder.Append(" PayTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', ");//支付时间
                    updateOrder.Append(" OrderStatusCode=3 ");
                    updateOrder.Append(" where OrderId='" + mOrder.OrderId + "'");

                    #endregion

                    #region 2.添加订单日志

                    //2	OrderId	varchar	50	0	订单编号
                    //3	OperType	varchar	10	0	操作类型:预订、支付、出票、修改等。
                    //4	OperTime	datetime	23	3	操作时间
                    //5	OperLoginName	varchar	50	0	操作员登录名
                    //6	OperUserName	varchar	100	0	操作员名称
                    //7	CpyNo	varchar	50	0	公司编号
                    //8	CpyType	int	4	0	公司类型
                    //9	CpyName	varchar	100	0	公司名称
                    //10	OperContent	text	4	0	操作内容描述
                    //11	WatchType	int	4	0	查看权限(1.平台 2.运营 3.供应 4.分销 5.采购)

                    string Content = "线下收银";

                    Log_Tb_AirOrder OrderLog = new Log_Tb_AirOrder();
                    OrderLog.id = Guid.NewGuid();
                    OrderLog.OrderId = mOrder.OrderId;
                    OrderLog.OperType = "支付";
                    OrderLog.OperTime = DateTime.Now;
                    OrderLog.OperLoginName = mUser.LoginName;
                    OrderLog.OperUserName = mUser.UserName;
                    OrderLog.CpyNo = mCompany.UninCode;
                    OrderLog.CpyType = mCompany.RoleType;
                    OrderLog.CpyName = mCompany.UninAllName;
                    OrderLog.OperContent = Content;
                    OrderLog.WatchType = 5;

                    #endregion

                    #region 添加到数据

                    List<string> sqlList = new List<string>();
                    sqlList.Add(updateOrder.ToString());

                    string LogTbAirOrder = Dal.Mapping.MappingHelper<Log_Tb_AirOrder>.CreateInsertModelSql(OrderLog);
                    sqlList.Add(LogTbAirOrder);

                    //添加到数据
                    result = new Dal.ControlBase.BaseData<Tb_Order_PayDetail>().ExecuteSqlTran(sqlList);

                    #endregion
                }
                catch (Exception)
                {
                    messge = "支付异常!";
                }
                return result;
            }
        }
    /// <summary>
    /// 绑定订单信息
    /// </summary>
    private void OrderBind()
    {
        try
        {
            string sqlWhere = " id='" + Request.QueryString["id"].ToString() + "' ";

            List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>;
            Tb_Ticket_Order        mOrder    = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null;

            if (mOrder != null)
            {
                sqlWhere = " OrderId='" + mOrder.OrderId + "' ";

                #region 订单信息

                //订单信息
                lblInPayNo.Text         = mOrder.InPayNo;
                lblLockId.Text          = mOrder.LockLoginName;
                lblLockTime.Text        = mOrder.LockTime.ToString("yyyy-MM-dd HH:mm:ss");
                lblOrderId.Text         = mOrder.OrderId;
                lblOrderSourceType.Text = GetDictionaryName("33", mOrder.OrderSourceType.ToString());
                lblOrderStatusCode.Text = GetDictionaryName("1", mOrder.OrderStatusCode.ToString());

                //lblPayMoney.Text = mOrder.PayMoney.ToString("F2");
                lblPayMoney.Text     = mOrder.OrderMoney.ToString("F2");
                lblPayNo.Text        = mOrder.PayNo;
                lblPayStatus.Text    = (mOrder.PayStatus == 1) ? "已付" : "未付";
                lblPayWay.Text       = GetDictionaryName("4", mOrder.PayWay.ToString());
                lblPNR.Text          = mOrder.PNR;
                lblPolicyPoint.Text  = mOrder.PolicyPoint + "/" + mOrder.ReturnPoint;
                lblPolicyPoint2.Text = mOrder.PolicyPoint.ToString();
                lblPolicyRemark.Text = mOrder.PolicyRemark;

                lblPolicySource.Text = GetDictionaryName("33", mOrder.PolicySource.ToString());

                // 显示 预订备注
                txtYDRemark.Text = mOrder.YDRemark;
                //退废改  申请理由
                txtTGQApplyReason.Text = mOrder.TGQApplyReason;
                // 拒绝理由
                txtTGQRefusalReason.Text = mOrder.TGQRefusalReason;

                if (mOrder.PolicySource > 2)
                {
                    trOutOrder.Visible = true;
                    //代付信息
                    lblOutOrderId.Text       = mOrder.OutOrderId;
                    lblOutOrderPayFlag.Text  = (mOrder.OutOrderPayFlag == true) ? "已代付" : "未代付";
                    lblOutOrderPayMoney.Text = mOrder.OutOrderPayMoney.ToString("F2");
                    lblOutOrderPayNo.Text    = mOrder.OutOrderPayNo;
                }
                else
                {
                    trOutOrder.Visible = false;
                }

                #endregion

                #region 乘机人信息

                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;

                if (PassengerList != null && PassengerList.Count > 0)
                {
                    RepPassenger.DataSource = PassengerList;
                    RepPassenger.DataBind();
                }

                #endregion

                #region 行程信息

                //现在
                List <Tb_Ticket_SkyWay> SkyWayList = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_SkyWay>;

                if (SkyWayList != null && SkyWayList.Count > 0)
                {
                    RepSkyWay.DataSource = SkyWayList;
                    RepSkyWay.DataBind();
                }

                //改签的,显示原航程信息
                if (mOrder.TicketStatus == 5)
                {
                    trRepSkyWayOld.Visible = true;
                    string tempSqlWhere = "OrderId='" + mOrder.OldOrderId + "'";
                    List <Tb_Ticket_SkyWay> SkyWayListOld = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { tempSqlWhere }) as List <Tb_Ticket_SkyWay>;

                    if (SkyWayListOld != null && SkyWayListOld.Count > 0)
                    {
                        RepSkyWayOld.DataSource = SkyWayListOld;
                        RepSkyWayOld.DataBind();
                    }
                }
                else
                {
                    trRepSkyWayOld.Visible = false;
                }
                #endregion

                #region 日志信息

                string sqlAirOrderWhere = " OrderId='" + mOrder.OrderId + "'";
                if (mCompany.RoleType == 1)
                {
                    sqlAirOrderWhere += " and WatchType in(0,1,2,3,4,5)";
                }
                else if (mCompany.RoleType == 2 || mCompany.RoleType == 3)
                {
                    sqlAirOrderWhere += " and WatchType in(2,3,4,5)";
                }
                else if (mCompany.RoleType == 4 || mCompany.RoleType == 5)
                {
                    sqlAirOrderWhere += " and WatchType in(4,5)";
                }
                sqlAirOrderWhere += " order by OperTime ";

                List <Log_Tb_AirOrder> AirOrderList = baseDataManage.CallMethod("Log_Tb_AirOrder", "GetList", null, new Object[] { sqlAirOrderWhere }) as List <Log_Tb_AirOrder>;

                if (AirOrderList != null && AirOrderList.Count > 0)
                {
                    RepOrderLog.DataSource = AirOrderList;
                    RepOrderLog.DataBind();
                }

                #endregion

                ViewState["Order"]     = mOrder;
                ViewState["Passenger"] = PassengerList;
            }
        }
        catch (Exception ex)
        {
        }
    }
Beispiel #28
0
    /// <summary>
    /// 获取打印数据
    /// </summary>
    /// <returns></returns>
    public PnrAnalysis.Model.TripPrintData GetPrintData()
    {
        PnrAnalysis.Model.TripPrintData model = null;
        if (Request["OrderId"] != null && Request["OrderId"].ToString() != "" && Request["PasId"] != null && Request["PasId"].ToString() != "")
        {
            model = new PnrAnalysis.Model.TripPrintData();
            model.m_strOrderId     = Request["OrderId"].ToString();
            model.m_strPassengerId = Request["PasId"].ToString();

            OrderInputParam InputParam = new OrderInputParam();
            string          ErrMsg     = "";
            //成人订单数据显示
            InputParam = OrderBLL.GetOrder(model.m_strOrderId, InputParam, out ErrMsg);
            if (InputParam != null && InputParam.OrderParamModel.Count > 0)
            {
                OrderMustParamModel OMP       = InputParam.OrderParamModel[0];
                Tb_Ticket_Passenger Passenger = OMP.PasList.Find(delegate(Tb_Ticket_Passenger _TP)
                {
                    return(_TP.id.ToString().ToUpper() == model.m_strPassengerId.ToUpper());
                });
                Tb_TripDistribution         tb_tripdistribution = null;
                Tb_Ticket_Order             Order   = OMP.Order;
                List <Tb_Ticket_SkyWay>     skyList = OMP.SkyList;
                PbProject.Model.ConfigParam config  = this.configparam;
                if (Passenger != null && Order != null)
                {
                    if (Passenger.TravelNumber.Trim() != "")
                    {
                        string sqlWhere = string.Format(" TripNum='{0}' and UseCpyNo='{1}' ", Passenger.TravelNumber.Trim(), Order.OwnerCpyNo);
                        List <Tb_TripDistribution> TTPList = this.baseDataManage.CallMethod("Tb_TripDistribution", "GetList", null, new object[] { sqlWhere }) as List <Tb_TripDistribution>;
                        if (TTPList != null && TTPList.Count > 0)
                        {
                            tb_tripdistribution = TTPList[0];
                        }
                    }
                    //管理员
                    if (mCompany.RoleType == 1)
                    {
                        string GYCpyNo = Order.OwnerCpyNo;
                        if (Order.OwnerCpyNo.Length >= 12)
                        {
                            GYCpyNo = GYCpyNo.Substring(0, 12);
                        }
                        List <Bd_Base_Parameters> baseParamList = baseDataManage.CallMethod("Bd_Base_Parameters", "GetList", null, new Object[] { "CpyNo='" + GYCpyNo + "'" }) as List <Bd_Base_Parameters>;
                        config = Bd_Base_ParametersBLL.GetConfigParam(baseParamList);
                    }

                    #region 获取 配置号
                    if (tb_tripdistribution != null)
                    {
                        //航协号
                        model.m_strIataCode = tb_tripdistribution.IataCode;
                        //中文填开单位
                        model.m_strCNTKTConjunction = tb_tripdistribution.OwnerCpyName;
                        //office
                        model.m_strAgentOffice = tb_tripdistribution.CreateOffice;
                        //行程单号
                        model.m_strTravelNumber = tb_tripdistribution.TripNum;
                    }
                    else
                    {
                        //行程单号为空时
                        if (config != null)
                        {
                            string   PrintOffice      = GetPrintOffice(Order.OwnerCpyNo, Order.CarryCode.Split('/')[0]);
                            string[] Arroffice        = config.Office.Split('^');        //office
                            string[] ArrIataCode      = config.IataCode.Split('^');      //航协号
                            string[] ArrTicketCompany = config.TicketCompany.Split('^'); //公司名称
                            for (int i = 0; i < Arroffice.Length; i++)
                            {
                                if (Arroffice.Length == ArrIataCode.Length && Arroffice.Length == ArrTicketCompany.Length)
                                {
                                    if (PrintOffice == "")
                                    {
                                        //Office
                                        model.m_strAgentOffice = Arroffice[i];
                                        //中文填开单位
                                        model.m_strCNTKTConjunction = ArrTicketCompany[i];
                                        //航协号
                                        model.m_strIataCode = ArrIataCode[i];//航协号
                                        break;
                                    }
                                    else
                                    {
                                        if (PrintOffice.ToUpper() == Arroffice[i].ToUpper())
                                        {
                                            //Office
                                            model.m_strAgentOffice = Arroffice[i];             //Office
                                            //中文填开单位
                                            model.m_strCNTKTConjunction = ArrTicketCompany[i]; //填开单位
                                            //航协号
                                            model.m_strIataCode = ArrIataCode[i];              //航协号
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    //乘客姓名
                    model.m_strPassengerName = Passenger.PassengerName;
                    //乘客证件号
                    model.m_strPassengerCardId = Passenger.Cid;
                    //签注
                    model.m_strEndorsements = ddlEndorsements.SelectedValue;
                    //小编码
                    model.m_strPnrB = Order.PNR.ToUpper();
                    //行程单号
                    model.m_strTravelNumber = Passenger.TravelNumber.Trim();
                    //舱位价
                    model.m_strSpaceFare = Passenger.PMFee.ToString("F2");
                    //基建费
                    model.m_strABFare = Passenger.ABFee.ToString("F2");
                    //燃油费
                    model.m_strFuelFare = Passenger.FuelFee.ToString("F2");
                    //总价
                    model.m_strTotalFare = (Passenger.PMFee + Passenger.ABFee + Passenger.FuelFee).ToString("F2");
                    //保险费
                    model.m_strInsuranceFare = "XXX";
                    //其他费用
                    model.m_strOtherFare = "0.00";
                    //票号
                    model.m_strTicketNumber = Passenger.TicketNumber;
                    //验证码
                    model.m_strCheckNum = Passenger.TravelNumber.Length > 4 ? (Passenger.TravelNumber.Substring(Passenger.TravelNumber.Length - 4, 4)) : txtCheckNum.Value;
                    //填开日期
                    model.m_strIssuedDate = System.DateTime.Now.ToString("yyyy-MM-dd");
                    //航段
                    if (skyList != null && skyList.Count > 0)
                    {
                        //第一段
                        model.m_strFCityName1    = skyList[0].FromCityName;    //出发城市
                        model.m_strTCityName1    = skyList[0].ToCityName;      //到达城市
                        model.m_strAirName1      = skyList[0].CarryName;       //航空公司名称
                        model.m_strAirCode1      = skyList[0].CarryCode;       //航空公司二字码
                        model.m_strFlightNum1    = skyList[0].FlightCode;      //航班号
                        model.m_strSpace1        = skyList[0].Space.ToUpper(); //舱位
                        model.m_strTicketBasis1  = skyList[0].Space.ToUpper(); //舱位等级
                        model.m_strFlyDate1      = skyList[0].FromDate.ToString("yyyy-MM-dd");
                        model.m_strFlyStartTime1 = skyList[0].FromDate.ToString("HH:mm");
                        model.m_strFlyEndTime1   = skyList[0].ToDate.ToString("HH:mm"); //到达时间
                        model.m_strTerminal1     = skyList[0].Terminal;                 //航站楼

                        //行李
                        model.m_strAllowPacket1 = "20K";
                        if (model.m_strSpace1 == "C")
                        {
                            model.m_strAllowPacket1 = "30K";
                        }
                        else if (model.m_strSpace1 == "F")
                        {
                            model.m_strAllowPacket1 = "40K";
                        }
                        //-------------------------------------------
                        //第二段
                        if (skyList.Count > 1)
                        {
                            model.m_strFCityName2    = skyList[1].FromCityName;    //出发城市
                            model.m_strTCityName2    = skyList[1].ToCityName;      //到达城市
                            model.m_strAirName2      = skyList[1].CarryName;       //航空公司名称
                            model.m_strAirCode2      = skyList[1].CarryCode;       //航空公司二字码
                            model.m_strFlightNum2    = skyList[1].FlightCode;      //航班号
                            model.m_strSpace2        = skyList[1].Space.ToUpper(); //舱位
                            model.m_strTicketBasis2  = skyList[1].Space.ToUpper(); //舱位等级
                            model.m_strFlyDate2      = skyList[1].FromDate.ToString("yyyy-MM-dd");
                            model.m_strFlyStartTime2 = skyList[1].FromDate.ToString("HH:mm");
                            model.m_strFlyEndTime2   = skyList[1].ToDate.ToString("HH:mm"); //到达时间
                            model.m_strTerminal2     = skyList[1].Terminal;                 //航站楼
                            //行李
                            model.m_strAllowPacket2 = "20K";
                            if (model.m_strSpace2 == "C")
                            {
                                model.m_strAllowPacket2 = "30K";
                            }
                            else if (model.m_strSpace2 == "F")
                            {
                                model.m_strAllowPacket2 = "40K";
                            }
                            if (model.m_strFCityName2 == model.m_strTCityName1)
                            {
                                if (model.m_strFCityName1 != model.m_strTCityName2)
                                {
                                    model.m_strTravelType = "3";//联程
                                }
                                else
                                {
                                    model.m_strTravelType = "2";//往返
                                }
                            }
                            else
                            {
                                if (skyList.Count == 2)
                                {
                                    model.m_strTravelType = "4";//缺口程
                                }
                                else
                                {
                                    model.m_strTravelType = "5";//多程
                                }
                            }
                        }
                    }
                }
            }
        }
        return(model);
    }
Beispiel #29
0
        /// <summary>
        /// 分离或者取消编码
        /// </summary>
        /// <returns></returns>
        private string PnrHandle(Tb_Ticket_Order Order, SendInsManage SendIns, StringBuilder sbLog, List <HashObject> selList, int INFCount)
        {
            string ErrMsg = "";

            try
            {
                if (Order != null && Order.PNR != "" && Order.PNR.Trim().Length == 6)
                {
                    PnrAnalysis.PnrModel pnrMode = SendIns.GetPnr(Order.PNR.Trim(), out ErrMsg);
                    if (pnrMode != null)
                    {
                        if (ErrMsg.Contains("授权"))
                        {
                            string[] strAuthArr = ErrMsg.Split('#')[1].Split('|');
                            ErrMsg = "";
                            foreach (string item in strAuthArr)
                            {
                                ErrMsg += "RMK TJ AUTH " + item + "<br/>";
                            }
                            ErrMsg = "需要授权,授权指令:<br />" + ErrMsg;
                            sbLog.Append("提取编码信息失败," + ErrMsg);
                        }
                        else
                        {
                            if (!pnrMode.PnrStatus.Contains("XX"))
                            {
                                if (pnrMode.PnrStatus.Contains("NO"))
                                {
                                    ErrMsg = "编码(" + Order.PNR + ")状态为NO,系统取消编码失败!";
                                    sbLog.Append(ErrMsg);
                                }
                                else if (pnrMode.PnrStatus.Contains("RR"))
                                {
                                    ErrMsg = "编码(" + Order.PNR + ")状态为RR,该编码已出票,不能取消!";
                                    sbLog.Append(ErrMsg);
                                }
                                else
                                {
                                    string TicketNumber = "";
                                    string Cmd = "", Office = "", RecvData = "";
                                    //用于分离编码的乘客姓名 不含婴儿
                                    List <string> pnameList = new List <string>();
                                    //循环选择的乘机人
                                    foreach (HashObject hashParam in selList)
                                    {
                                        if (hashParam["pasPType"].ToString() != "3")
                                        {
                                            pnameList.Add(hashParam["pasName"].ToString());
                                        }
                                        TicketNumber = hashParam["pasTicketNum"].ToString();
                                        if (TicketNumber != "" && !KongZhiXiTong.Contains("|69|"))
                                        {
                                            Office   = hashParam["office"].ToString();
                                            Cmd      = "DETR:TN/" + TicketNumber;
                                            RecvData = SendIns.Send(Cmd, ref Office, 0);
                                            if (!RecvData.Contains("OPEN FOR USE"))
                                            {
                                                ErrMsg = "票号(" + TicketNumber + ")状态异常,不能提交申请!";
                                                sbLog.Append(ErrMsg);
                                                break;
                                            }
                                        }
                                    }
                                    //没有出错时
                                    if (ErrMsg == "")
                                    {
                                        if (INFCount > 0)
                                        {
                                            //编码状态不是已经出票的PNR
                                            if (pnrMode != null && !pnrMode.PnrStatus.Contains("RR"))
                                            {
                                                //有婴儿直接提交
                                                SendIns.CancelPnr(Order.PNR, Order.Office);
                                            }
                                        }
                                        else
                                        {
                                            //编码状态不是已经出票的PNR
                                            if (pnrMode != null)
                                            {
                                                if (!pnrMode.PnrStatus.Contains("RR"))
                                                {
                                                    //取消编码
                                                    if (SendIns.CancelPnr(Order.PNR, Order.Office))
                                                    {
                                                        ErrMsg = "";
                                                    }
                                                    else
                                                    {
                                                        ErrMsg = "取消编码(" + Order.PNR + ")失败!";
                                                    }
                                                }
                                                else
                                                {
                                                    ErrMsg = "编码状态为RR的编码,不能取消!";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        sbLog.Append("提取编码信息失败,系统取消编码失败!");
                    }
                }
                else
                {
                    sbLog.Append("订单不存在!");
                }
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message;
            }
            finally
            {
            }
            return(ErrMsg);
        }
        /* BSP常见错误信息
         * MRT:HT0LYJ IGNORED
         * INCOMPLETE PNR/FN
         * PLEASE CHECK TKT ELEMENT
         * CHECK BLINK CODE
         * ELE NBR
         */
        /// <summary>
        /// BSP订单处理
        /// </summary>
        /// <param name="Order"></param>
        private void BspHandle(Tb_Ticket_Order Order, List <ListParam> LPList, BSPShowLog Log)
        {  //订单日志
            StringBuilder sbLog = new StringBuilder();

            if (Order != null)
            {
                //订单出票公司信息
                ListParam TicketLP = LPList.Find(delegate(ListParam _tempLP)
                {
                    return(Order.OwnerCpyNo.Contains(_tempLP.CpyNo));
                });

                //编码解析类
                PnrAnalysis.FormatPNR pnrFormat = new PnrAnalysis.FormatPNR();
                //判断标识
                List <string> NumTickList          = new List <string>();
                List <string> PTList               = null;
                List <Tb_Ticket_Passenger> PasList = null;
                try
                {
                    Log(0, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "订单号:" + Order.OrderId + "=======================start=====================\r\n");
                    string GYCpyNo = Order.OwnerCpyNo;
                    if (GYCpyNo.Length >= 12)
                    {
                        GYCpyNo = GYCpyNo.Substring(0, 12);
                    }
                    string CarrayCode = Order.CarryCode.Split('/')[0];
                    Tb_Ticket_PrintOffice PrintOffice = GetPrintOffice(GYCpyNo, CarrayCode);
                    if (PrintOffice == null || PrintOffice.PrintCode == "")
                    {
                        Log(0, string.Format("{0}未设置打票机号,请手动出票!", CarrayCode));
                        sbLog.Append(string.Format("{0}未设置打票机号,请手动出票!", CarrayCode));
                        return;
                    }
                    //出票Office
                    string pOffice   = string.IsNullOrEmpty(PrintOffice.OfficeCode) ? Order.PrintOffice : PrintOffice.OfficeCode;
                    string PrintCode = PrintOffice.PrintCode;
                    string Pnr       = Order.PNR;//Pnr编码
                    if (pOffice == "")
                    {
                        Log(0, string.Format("{0}出票Office不能为空!", CarrayCode));
                        sbLog.Append(string.Format("{0}出票Office不能为空!", CarrayCode));
                        return;
                    }
                    //获取乘客
                    string sqlWhere           = string.Format(" OrderId='{0}' order by PassengerType", Order.OrderId);
                    Tb_Ticket_Passenger pMode = null;
                    PasList = Manage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                    if (PasList == null || PasList.Count == 0)
                    {
                        Log(0, string.Format("订单号:{0}没有找到对应的乘客信息!", Order.OrderId));
                        sbLog.Append(string.Format("订单号:{0}没有找到对应的乘客信息!", Order.OrderId));
                        return;
                    }
                    else
                    {
                        pMode = PasList[0];
                    }
                    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);
                    //指令管理类
                    //SendInsManage SendManage = new SendInsManage(Order.OwnerCpyNo, GYCpyNo, config);
                    if (config == null)
                    {
                        Log(0, string.Format("订单号{0},公司{1}未设置使用配置信息,请设置!", Order.OrderId, CarrayCode));
                        sbLog.Append(string.Format("订单号{0},公司{1}未设置使用配置信息,请设置!", Order.OrderId, CarrayCode));
                        return;
                    }
                    if (string.IsNullOrEmpty(Order.PNR))
                    {
                        Log(0, string.Format("订单号{0}中没有PNR,请检查!", Order.OrderId));
                        sbLog.Append(string.Format("订单号{0}中没有PNR,请检查!", Order.OrderId));
                        return;
                    }

                    ParamObject PM = new ParamObject();
                    PM.ServerIP   = config.WhiteScreenIP;
                    PM.ServerPort = int.Parse(config.WhiteScreenPort);
                    PM.Office     = pOffice;

                    //发送指令
                    string SendIns = "RT" + Pnr;
                    //返回数据
                    string Recvdata = string.Empty;
                    PM.code = SendIns;
                    PM.IsPn = true;
                    //  Recvdata = SendNewPID.SendCommand(PM);
                    Recvdata = WriteLogDB(PM, TicketLP);
                    //指令日志
                    Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                    //授权检查
                    if (Recvdata.ToUpper().Contains("授权"))
                    {
                        Log(0, string.Format("订单号{0},编码{1} 出票Office{2},发送指令需要授权!", Order.OrderId, Pnr, pOffice));
                        sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},发送指令需要授权!", Order.OrderId, Pnr, pOffice));
                        return;
                    }
                    else if (Recvdata.ToUpper().Contains("CANCELLED"))
                    {
                        Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码已取消,出票失败!", Order.OrderId, Pnr, pOffice));
                        sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码已取消,出票失败!", Order.OrderId, Pnr, pOffice));
                        return;
                    }
                    string Msg = "";
                    string Xe = "", RR = "";
                    string PnrStatus = pnrFormat.GetPnrStatus(Recvdata, out Msg);
                    if (PnrStatus.Contains("NO"))
                    {
                        Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},不能自动出票!!", Order.OrderId, Pnr, pOffice, PnrStatus));
                        sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},不能自动出票!!", Order.OrderId, Pnr, pOffice, PnrStatus));
                        return;
                    }
                    //存在的票号
                    PTList = GetTicketNum(Pnr, Recvdata.ToUpper(), pnrFormat);
                    List <string> RRList = null;
                    List <string> XEList = null;
                    if (PTList.Count == 0)
                    {
Start:
                        {
                            //进行出票
                            HashObject hash = GetNumList(Recvdata);
                            XEList = hash["XEList"] as List <string>;
                            RRList = hash["RRList"] as List <string>;
                            List <string> StartXeList = hash["StartXeList"] as List <string>;
                            //XE项
                            if (StartXeList.Count > 0)
                            {
                                for (int i = 0; i < StartXeList.Count; i++)
                                {
                                    string XeStr = StartXeList[i];
                                    if (XeStr != "")
                                    {
                                        //发送指令
                                        SendIns = "RT" + Pnr + "|XE" + XeStr + "|@";
                                        PM.code = SendIns;
                                        PM.IsPn = false;
                                        //Recvdata = SendNewPID.SendCommand(PM);//MRT:JG61M2 IGNORED
                                        Recvdata = WriteLogDB(PM, TicketLP);
                                        //指令日志
                                        Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));

                                        //判断是否XE成功
                                        if (pnrFormat.INFMarkIsOK(Recvdata, out Msg))
                                        {
                                            /*  3U8881  E TU30APR  CTUPEK HK1   0730 1005
                                             * JG61M2 -  航空公司使用自动出票时限, 请检查PNR
                                             *** 预订酒店指令HC, 详情  HC:HELP   ***
                                             */
                                            //发送指令
                                            SendIns = "RT" + Pnr;
                                            PM.code = SendIns;
                                            PM.IsPn = true;
                                            //Recvdata = SendNewPID.SendCommand(PM);
                                            Recvdata = WriteLogDB(PM, TicketLP);
                                            //指令日志
                                            Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                                            goto Start;
                                        }
                                    }
                                }
                            }
                        }



                        string patPrice = "pat:a";
                        if (!Order.IsChdFlag)
                        {
                            //成人
                            patPrice = "pat:a";
                        }
                        else
                        {
                            //儿童
                            patPrice = "pat:a*ch";
                        }
                        //发送指令
                        SendIns = "RT" + Pnr + "|" + patPrice;
                        PM.code = SendIns;
                        PM.IsPn = false;
                        //Recvdata = SendNewPID.SendCommand(PM);
                        Recvdata = WriteLogDB(PM, TicketLP);
                        //指令日志
                        Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                        if (Recvdata.IndexOf("PAT") == -1)
                        {
                            //发送指令
                            Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码已取消,未能PAT出票价,出票失败!", Order.OrderId, Pnr, pOffice));
                            sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码已取消,未能PAT出票价,出票失败!", Order.OrderId, Pnr, pOffice));
                            return;
                        }

                        //比较
                        string  xuhao = "", Seat = "", Err = "";
                        decimal _xsFare          = 0m;
                        bool    IsExistParice    = false;
                        PnrAnalysis.PatModel PAT = pnrFormat.GetPATInfo(Recvdata.Replace("\r", ""), out Err);
                        foreach (PatInfo pat in PAT.UninuePatList)
                        {
                            decimal.TryParse(pat.Fare, out _xsFare);
                            //存在此价格
                            if (_xsFare == pMode.PMFee)
                            {
                                IsExistParice = true;
                                xuhao         = pat.SerialNum;
                                Seat          = pat.SeatGroup;
                                break;
                            }
                        }
                        if (!IsExistParice)
                        {
                            Log(0, string.Format("订单号{0},编码{1} 出票Office{2},舱位价{3}与Pat价格{4}不一致,出票失败!", Order.OrderId, Pnr, pOffice, pMode.PMFee, _xsFare));
                            sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},舱位价{3}与Pat价格{4}不一致,出票失败!", Order.OrderId, Pnr, pOffice, pMode.PMFee, _xsFare));
                            return;
                        }

                        //做价格进去
                        SendIns = "RT" + Pnr + "|" + patPrice + "|SFC:" + xuhao + "|@";
                        PM.code = SendIns;
                        PM.IsPn = false;
                        //Recvdata = SendNewPID.SendCommand(PM);
                        Recvdata = WriteLogDB(PM, TicketLP);
                        //指令日志
                        Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                        if (Recvdata.Contains("超时") || Recvdata.Contains("NO PNR"))
                        {
                            //Recvdata = SendNewPID.SendCommand(PM);
                            Recvdata = WriteLogDB(PM, TicketLP);
                            //指令日志
                            Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                        }

                        //做备注
                        decimal _Discount = 0m;
                        if (decimal.TryParse(Order.Discount, out _Discount) && Order.Space.IndexOf("Y") == -1 && Order.Space.IndexOf("C") == -1 && Order.Space.IndexOf("F") == -1 && _Discount < 100)
                        {
                            //做价格进去
                            SendIns = "RT" + Pnr + "|EI:不得签转|@";
                            PM.code = SendIns;
                            PM.IsPn = false;
                            //Recvdata = SendNewPID.SendCommand(PM);
                            Recvdata = WriteLogDB(PM, TicketLP);
                            //指令日志
                            Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                            if (Recvdata != "" && Recvdata.Contains("超时"))
                            {
                                //Recvdata = SendNewPID.SendCommand(PM);
                                Recvdata = WriteLogDB(PM, TicketLP);
                                //指令日志
                                Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                            }
                        }



                        foreach (string item in XEList)
                        {
                            if (item != "")
                            {
                                Xe += "XE" + item + "|";
                            }
                        }
                        foreach (string item in RRList)
                        {
                            if (item != "")
                            {
                                RR += item + "RR" + "|";
                            }
                        }
                        if (Xe.Trim(new char[] { '|' }) == "")
                        {
                            Xe = "";
                        }
                        else
                        {
                            Xe = "|" + Xe.Trim('|') + "|";
                        }
                        if (RR.Trim(new char[] { '|' }) == "")
                        {
                            RR = "";
                        }
                        else
                        {
                            RR = "|" + RR.Trim('|') + "|";
                        }
                        if (RR == "")
                        {
                            RR = "|";
                        }
                        if (XEList == null || XEList.Count == 0 || Xe == "")
                        {
                            Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},未能取出出票时限!!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},未能取出出票时限!!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            return;
                        }

                        //组合打票指令
                        string etdz = "rt" + Pnr + Xe + RR.TrimEnd('|') + "|ETDZ " + PrintCode;
                        etdz = etdz.Replace("||", "|");

                        //出票
                        SendIns = etdz;
                        PM.code = SendIns;
                        PM.IsPn = false;
                        // Recvdata = SendNewPID.SendCommand(PM);
                        Recvdata = WriteLogDB(PM, TicketLP);
                        //指令日志
                        Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));


                        if (Recvdata.Contains("超时") || Recvdata.Contains("NO PNR"))
                        {
                            //Recvdata = SendNewPID.SendCommand(PM);
                            Recvdata = WriteLogDB(PM, TicketLP);
                            //指令日志
                            Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                        }
                        if (Recvdata.Contains("请输入证件信息"))
                        {
                            Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},编码中没有证件号,请输入证件信息,否则不能出票!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3},编码中没有证件号,请输入证件信息,否则不能出票!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            return;
                        }
                        if (Recvdata.ToUpper().Contains("STOCK"))
                        {
                            Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3}," + Recvdata + "没有票号了!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3}," + Recvdata + "没有票号了!", Order.OrderId, Pnr, pOffice, PnrStatus));
                            return;
                        }
                        //出票成功
                        if (Recvdata.Contains("CNY") && Recvdata.ToUpper().Contains(Pnr.ToUpper()))
                        {
                            /*CNY2730.00      HF9550
                             * 876-3250823439         876-3250823441  */

                            SendIns = "RT" + Pnr;
                            PM.code = SendIns;
                            PM.IsPn = true;
                            //Recvdata = SendNewPID.SendCommand(PM);
                            Recvdata = WriteLogDB(PM, TicketLP);
                            //指令日志
                            Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                            //存在的票号
                            PTList = GetTicketNum(Pnr, Recvdata.ToUpper(), pnrFormat);
                        }
                        else
                        {
                            //出票失败 重试
                            if (!Recvdata.ToUpper().Contains("**ELECTRONIC TICKET PNR**") &&
                                Recvdata.ToUpper().Contains("SSR TKNE") &&
                                Recvdata.ToUpper().Contains("/DPN") &&
                                Recvdata.ToUpper().Contains("RMK " + CarrayCode + "/"))
                            {
                                //"ETRY:"   重试指令
                                SendIns = "RT" + Pnr + "|ETRY:";
                                PM.code = SendIns;
                                PM.IsPn = false;
                                //Recvdata = SendNewPID.SendCommand(PM);
                                Recvdata = WriteLogDB(PM, TicketLP);
                                //指令日志
                                Log(0, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Order.OrderId, SendIns, Recvdata));
                            }
                            else
                            {
                                Log(0, string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3}," + "出票失败,{4}", Order.OrderId, Pnr, pOffice, PnrStatus, Recvdata));
                                sbLog.Append(string.Format("订单号{0},编码{1} 出票Office{2},编码状态为{3}," + "出票失败,{4}", Order.OrderId, Pnr, pOffice, PnrStatus, Recvdata));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log(0, string.Format("订单号{0},出票异常:{1}", Order.OrderId, ex.Message + ex.Source + ex.StackTrace.ToString()));
                    sbLog.Append(string.Format("订单号{0},出票异常:{1}", Order.OrderId, ex.Message + ex.Source + ex.StackTrace.ToString()));
                }
                finally
                {
                    string          TicketMsg = "";
                    Log_Tb_AirOrder OrderLog  = new Log_Tb_AirOrder();
                    //执行SQl语句
                    List <string> sqlList = new List <string>();
                    //修改订单数据列表
                    List <string> OrderList = new List <string>();
                    if (TicketLP != null)
                    {
                        //解锁
                        OrderList.Add(" LockCpyNo='' ");
                        OrderList.Add(" LockLoginName='' ");
                        OrderList.Add(" LockTime='1900-01-01' ");

                        OrderList.Add(" CPTime=getdate() ");
                        OrderList.Add(" CPName='管理员' ");
                        OrderList.Add(string.Format(" CPCpyNo='{0}' ", TicketLP.CpyNo));
                        OrderList.Add(" CPRemark='BSP自动出票' ");
                        OrderList.Add(string.Format(" CPCpyName='{0}' ", TicketLP.UninAllName));

                        //日志
                        OrderLog.id            = Guid.NewGuid();
                        OrderLog.OrderId       = Order.OrderId;
                        OrderLog.OperType      = "出票";
                        OrderLog.OperTime      = DateTime.Now;
                        OrderLog.OperLoginName = "管理员";
                        OrderLog.OperUserName  = "******";
                        OrderLog.CpyNo         = TicketLP.CpyNo;
                        OrderLog.CpyType       = 1;
                        OrderLog.CpyName       = TicketLP.UninAllName;
                    }

                    if (PTList != null && PTList.Count > 0 && PasList != null && PasList.Count > 0)
                    {
                        string PasName = "", TicketNumber = "";
                        for (int i = 0; i < PTList.Count; i++)
                        {
                            if (PTList[i].Split('|').Length == 2)
                            {
                                TicketNumber = PTList[i].Split('|')[0];
                                PasName      = PTList[i].Split('|')[1];
                                Tb_Ticket_Passenger Passenger = PasList.Find(delegate(Tb_Ticket_Passenger _tempPassenger)
                                {
                                    return(PTList[i].ToUpper().Trim().Contains(_tempPassenger.PassengerName.ToUpper().Trim()));
                                });
                                if (Passenger != null)
                                {
                                    sqlList.Add(string.Format(" update Tb_Ticket_Passenger set TicketNumber='{0}',TicketStatus=2 where id='{1}' and PassengerName='{2}' ", TicketNumber, Passenger.id.ToString(), Passenger.PassengerName));
                                }
                            }
                        }
                        //修改订单数据
                        OrderList.Add(" TicketStatus=2 ");
                        OrderList.Add(" OrderStatusCode=4 ");
                        if (OrderList.Count > 0)
                        {
                            sqlList.Add(string.Format(" update Tb_Ticket_Order set {0} where id='{1}' ", string.Join(",", OrderList.ToArray()), Order.id.ToString()));
                        }

                        //出票成功
                        TicketMsg          = "出票成功";
                        OrderLog.WatchType = 5;
                        //日志
                        OrderLog.OperContent = "订单号:" + Order.OrderId + " BSP自动出票成功," + string.Format(",", PasList.ToArray());
                        //修改数据库状态
                    }
                    else
                    {
                        //出票失败
                        TicketMsg = "出票失败";
                        //修改订单自动出票尝试次数
                        if (Order.AutoPrintTimes > 3)//尝试次数大于3改为手动出票
                        {
                            sqlList.Add(string.Format(" update Tb_Ticket_Order set AutoPrintFlag=0,AutoPrintTimes=CAST(AutoPrintTimes as int)+1  where id='{0}' ", Order.id.ToString()));
                        }
                        else
                        {
                            sqlList.Add(string.Format(" update Tb_Ticket_Order set AutoPrintTimes=CAST(AutoPrintTimes as int)+1  where id='{0}' ", Order.id.ToString()));
                        }
                        OrderLog.WatchType = 2;
                        //日志
                        OrderLog.OperContent = "BSP自动出票失败," + sbLog.ToString();
                    }
                    //日志
                    string tempSql = Dal.Mapping.MappingHelper <Log_Tb_AirOrder> .CreateInsertModelSql(OrderLog);

                    sqlList.Add(tempSql);

                    string Msg = "";
                    //修改数据库
                    if (!Manage.ExecuteSqlTran(sqlList, out Msg))
                    {
                        Log(0, string.Format("订单号{0},修改数据库失败:{1}", Order.OrderId, Msg));
                    }
                    Log(0, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "订单号:" + Order.OrderId + "  " + TicketMsg + "=======================end=====================\r\n");
                }
            }
        }